Skip to content
This repository has been archived by the owner on Dec 30, 2023. It is now read-only.

Commit

Permalink
Fixed dispatch issues during activation (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
Richasy authored Sep 28, 2023
1 parent 1d956d2 commit 491f18a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/App/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void ActivateWindow(AppActivationArguments arguments = default)
{
LaunchWindow();
}
else if (_window.Visible && HandleCloseEvents && arguments.Data != null)
else if (_window.Visible && HandleCloseEvents && arguments?.Data == null)
{
_window.Hide();
}
Expand All @@ -76,9 +76,15 @@ public void ActivateWindow(AppActivationArguments arguments = default)
PInvoke.SetForegroundWindow(new HWND(WindowNative.GetWindowHandle(_window)));
}
if (arguments?.Data is IActivatedEventArgs args)
try
{
if (arguments?.Data is IActivatedEventArgs args)
{
MainWindow.Instance.ActivateArgumentsAsync(args);
}
}
catch (Exception)
{
MainWindow.Instance.ActivateArgumentsAsync(args);
}
});
}
Expand Down

0 comments on commit 491f18a

Please sign in to comment.