diff --git a/Flow.Launcher/App.xaml.cs b/Flow.Launcher/App.xaml.cs index 969bb75bb..cedced181 100644 --- a/Flow.Launcher/App.xaml.cs +++ b/Flow.Launcher/App.xaml.cs @@ -32,7 +32,7 @@ namespace Flow.Launcher #region Public Properties public static IPublicAPI API { get; private set; } - public static bool Exiting => _mainWindow.CanClose; + public static bool LoadingOrExiting => _mainWindow == null || _mainWindow.CanClose; #endregion diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index c53a4ea80..c1c0f96a7 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -82,7 +82,7 @@ public partial class SettingWindow _viewModel.PropertyChanged -= ViewModel_PropertyChanged; // If app is exiting, settings save is not needed because main window closing event will handle this - if (App.Exiting) return; + if (App.LoadingOrExiting) return; // Save settings when window is closed _settings.Save(); App.API.SavePluginSettings(); diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 6e1b0dd93..48652f063 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -1729,7 +1729,7 @@ namespace Flow.Launcher.ViewModel public void Show() { // When application is exiting, we should not show the main window - if (App.Exiting) return; + if (App.LoadingOrExiting) return; // When application is exiting, the Application.Current will be null Application.Current?.Dispatcher.Invoke(() => diff --git a/Flow.Launcher/WelcomeWindow.xaml.cs b/Flow.Launcher/WelcomeWindow.xaml.cs index ef0706765..fe8a63e52 100644 --- a/Flow.Launcher/WelcomeWindow.xaml.cs +++ b/Flow.Launcher/WelcomeWindow.xaml.cs @@ -96,7 +96,7 @@ namespace Flow.Launcher private void Window_Closed(object sender, EventArgs e) { // If app is exiting, settings save is not needed because main window closing event will handle this - if (App.Exiting) return; + if (App.LoadingOrExiting) return; // Save settings when window is closed _settings.Save(); }