mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-18 18:20:39 +08:00
@@ -107,7 +107,10 @@ namespace MaaWpfGui.Services
|
||||
|
||||
private static void AppExit(object sender, EventArgs e)
|
||||
{
|
||||
System.Windows.Application.Current.MainWindow?.Close();
|
||||
if (Instances.TaskQueueViewModel.ConfirmExit())
|
||||
{
|
||||
System.Windows.Application.Current.Shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnNotifyIconDoubleClick(object sender, EventArgs e)
|
||||
|
||||
@@ -173,10 +173,18 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
|
||||
public bool Running { get; set; }
|
||||
|
||||
public bool Closing { get; set; }
|
||||
|
||||
private readonly DispatcherTimer _timer = new DispatcherTimer();
|
||||
|
||||
private bool ConfirmExit()
|
||||
public bool ConfirmExit()
|
||||
{
|
||||
if (Closing)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Closing = true;
|
||||
if (Application.Current.IsShuttingDown())
|
||||
{
|
||||
// allow close if application is shutting down
|
||||
@@ -195,8 +203,12 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
return true;
|
||||
}
|
||||
|
||||
var window = Instances.MainWindowManager.GetWindowIfVisible();
|
||||
var result = MessageBoxHelper.ShowNative(window, LocalizationHelper.GetString("ConfirmExitText"), LocalizationHelper.GetString("ConfirmExitTitle"), "MAA", MessageBoxButton.YesNo, MessageBoxImage.Information, MessageBoxResult.No);
|
||||
var result = MessageBoxHelper.Show(
|
||||
LocalizationHelper.GetString("ConfirmExitText"),
|
||||
LocalizationHelper.GetString("ConfirmExitTitle"),
|
||||
MessageBoxButton.YesNo,
|
||||
MessageBoxImage.Question);
|
||||
Closing = false;
|
||||
return result == MessageBoxResult.Yes;
|
||||
}
|
||||
|
||||
@@ -808,6 +820,15 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
/// </summary>
|
||||
public async void LinkStart()
|
||||
{
|
||||
Instances.TaskQueueViewModel.Running = true;
|
||||
var i = 0;
|
||||
while (true)
|
||||
{
|
||||
await Task.Delay(1000);
|
||||
AddLog(i++.ToString());
|
||||
}
|
||||
|
||||
return;
|
||||
Instances.SettingsViewModel.SetupSleepManagement();
|
||||
|
||||
if (!_runningState.GetIdle())
|
||||
|
||||
Reference in New Issue
Block a user