Add exit function to the main interface for Desktop

This commit is contained in:
2dust
2024-11-03 14:48:13 +08:00
parent 4f05b93d63
commit 258e822c13
8 changed files with 62 additions and 16 deletions
@@ -52,6 +52,8 @@ namespace ServiceLib.ViewModels
public ReactiveCommand<Unit, Unit> ReloadCmd { get; }
public ReactiveCommand<Unit, Unit> ExitCmd { get; }
[Reactive]
public bool BlReloadEnabled { get; set; }
@@ -187,6 +189,11 @@ namespace ServiceLib.ViewModels
await Reload();
});
ExitCmd = ReactiveCommand.CreateFromTask(async () =>
{
await Exit();
});
RegionalPresetDefaultCmd = ReactiveCommand.CreateFromTask(async () =>
{
await ApplyRegionalPreset(EPresetType.Default);
@@ -588,6 +595,16 @@ namespace ServiceLib.ViewModels
}
}
private async Task Exit()
{
if (await _updateView?.Invoke(EViewAction.ShowYesNo, null) == false)
{
return;
}
await MyAppExitAsync(false);
}
#endregion core job
#region Presets