diff --git a/Flow.Launcher/App.xaml.cs b/Flow.Launcher/App.xaml.cs index 969bb75bbf9..cedced181f2 100644 --- a/Flow.Launcher/App.xaml.cs +++ b/Flow.Launcher/App.xaml.cs @@ -32,7 +32,7 @@ public partial class App : IDisposable, ISingleInstanceApp #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 c53a4ea80c4..c1c0f96a7bc 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -82,7 +82,7 @@ private void OnClosed(object sender, EventArgs e) _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 807275fcbd5..c4da384f861 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -1729,7 +1729,7 @@ public bool ShouldIgnoreHotkeys() 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 ef07067650c..fe8a63e52da 100644 --- a/Flow.Launcher/WelcomeWindow.xaml.cs +++ b/Flow.Launcher/WelcomeWindow.xaml.cs @@ -96,7 +96,7 @@ private void ContentFrame_Loaded(object sender, RoutedEventArgs e) 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(); }