Add soft termination for settings window

This commit is contained in:
pizzaboxer 2024-09-27 23:33:57 +01:00
parent 81c6512055
commit fe04b468b0
No known key found for this signature in database
GPG Key ID: 59D4A1DBAD0F2BA8
2 changed files with 10 additions and 1 deletions

View File

@ -66,6 +66,15 @@ namespace Bloxstrap
Environment.Exit(exitCodeNum); Environment.Exit(exitCodeNum);
} }
public static void SoftTerminate(ErrorCode exitCode = ErrorCode.ERROR_SUCCESS)
{
int exitCodeNum = (int)exitCode;
Logger.WriteLine("App::SoftTerminate", $"Terminating with exit code {exitCodeNum} ({exitCode})");
Current.Dispatcher.Invoke(() => Current.Shutdown(exitCodeNum));
}
void GlobalExceptionHandler(object sender, DispatcherUnhandledExceptionEventArgs e) void GlobalExceptionHandler(object sender, DispatcherUnhandledExceptionEventArgs e)
{ {
e.Handled = true; e.Handled = true;

View File

@ -102,7 +102,7 @@ namespace Bloxstrap.UI.Elements.Settings
App.State.Save(); App.State.Save();
if (!e.Cancel) if (!e.Cancel)
App.Terminate(); App.SoftTerminate();
} }
} }
} }