This commit is contained in:
MistEO
2022-07-19 17:12:01 +08:00
6 changed files with 12 additions and 16 deletions

View File

@@ -153,7 +153,7 @@ namespace MeoAsstGui
Execute.OnUIThread(() =>
{
_windowManager.ShowMessageBox("出现未知异常", "错误", icon: MessageBoxImage.Error);
Environment.Exit(0);
App.Current.Shutdown();
});
}
var mainModel = _container.Get<TaskQueueViewModel>();
@@ -217,7 +217,7 @@ namespace MeoAsstGui
case AsstMsg.InitFailed:
_windowManager.ShowMessageBox("初始化错误!请检查是否使用了中文路径", "错误", icon: MessageBoxImage.Error);
Environment.Exit(0);
App.Current.Shutdown();
break;
case AsstMsg.ConnectionInfo:

View File

@@ -553,7 +553,7 @@ namespace MeoAsstGui
{
var fInfo = new FLASHWINFO();
fInfo.cbSize = Convert.ToUInt32(Marshal.SizeOf(fInfo));
fInfo.hwnd = hWnd != default ? hWnd : new WindowInteropHelper(Application.Current.MainWindow).Handle;
fInfo.hwnd = hWnd != default ? hWnd : new WindowInteropHelper(App.Current.MainWindow).Handle;
fInfo.dwFlags = (uint)type;
fInfo.uCount = count;
fInfo.dwTimeout = 0;

View File

@@ -102,7 +102,7 @@ namespace MeoAsstGui
private void App_exit(object sender, EventArgs e)
{
System.Windows.Application.Current.Shutdown();
App.Current.Shutdown();
}
private void App_show(object sender, EventArgs e)

View File

@@ -99,7 +99,7 @@ namespace MeoAsstGui
protected override void OnClose()
{
System.Windows.Application.Current.Shutdown();
App.Current.Shutdown();
}
}
}

View File

@@ -884,11 +884,9 @@ namespace MeoAsstGui
break;
case ActionType.ExitSelf:
if (new ToastNotification().CheckToastSystem())
{
ToastNotificationManagerCompat.History.Clear(); //exit似乎不会走bootstapper单独清一下通知
}
Environment.Exit(0);
// Shutdown 会调用 OnExit 但 Exit 不会
App.Current.Shutdown();
// Enviroment.Exit(0);
break;
case ActionType.ExitEmulator:
@@ -903,11 +901,9 @@ namespace MeoAsstGui
{
AddLog("模拟器关闭失败", "DarkRed");
}
if (new ToastNotification().CheckToastSystem())
{
ToastNotificationManagerCompat.History.Clear(); //exit似乎不会走bootstapper单独清一下通知
}
Environment.Exit(0);
// Shutdown 会调用 OnExit 但 Exit 不会
App.Current.Shutdown();
// Enviroment.Exit(0);
break;
case ActionType.Shutdown:

View File

@@ -242,7 +242,7 @@ namespace MeoAsstGui
newProcess.StartInfo.FileName = AppDomain.CurrentDomain.FriendlyName;
newProcess.StartInfo.WorkingDirectory = Directory.GetCurrentDirectory();
newProcess.Start();
Application.Current.Shutdown();
App.Current.Shutdown();
return true;
}