Skip to content

Commit 836d09e

Browse files
committed
Ignore main window show when exiting
1 parent 1ffbbca commit 836d09e

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Flow.Launcher/App.xaml.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public partial class App : IDisposable, ISingleInstanceApp
3131

3232
public static IPublicAPI API { get; private set; }
3333
public static JoinableTaskFactory JTF { get; } = new JoinableTaskFactory(new JoinableTaskContext());
34+
public static bool Exitting => _mainWindow.CanClose;
3435

3536
#endregion
3637

@@ -39,7 +40,7 @@ public partial class App : IDisposable, ISingleInstanceApp
3940
private static readonly string ClassName = nameof(App);
4041

4142
private static bool _disposed;
42-
private MainWindow _mainWindow;
43+
private static MainWindow _mainWindow;
4344
private readonly MainViewModel _mainVM;
4445
private readonly Settings _settings;
4546

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1649,6 +1649,9 @@ public bool ShouldIgnoreHotkeys()
16491649

16501650
public void Show()
16511651
{
1652+
// When application is exiting, we should not show the main window
1653+
if (App.Exitting) return;
1654+
16521655
// When application is exiting, the Application.Current will be null
16531656
Application.Current?.Dispatcher.Invoke(() =>
16541657
{

0 commit comments

Comments
 (0)