From ef197d161185b4fae434c030eb515f916e411031 Mon Sep 17 00:00:00 2001 From: Megalon Date: Mon, 1 Jun 2020 19:25:35 -0700 Subject: [PATCH] Shutdown app when main window closed --- ModAssistant/MainWindow.xaml.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ModAssistant/MainWindow.xaml.cs b/ModAssistant/MainWindow.xaml.cs index eafd161..4eca6c9 100644 --- a/ModAssistant/MainWindow.xaml.cs +++ b/ModAssistant/MainWindow.xaml.cs @@ -95,6 +95,21 @@ namespace ModAssistant } } + /* Force the app to shutdown when The main window is closed. + * + * Explaination: + * OneClickStatus is initialized as a static object, + * so the window will exist, even if it is unused. + * This would cause Mod Assistant to not shutdown, + * because technically a window was still open. + */ + protected override void OnClosed(EventArgs e) + { + base.OnClosed(e); + + Application.Current.Shutdown(); + } + private async void LoadVersionsAsync() { try