Skip to content

Commit

Permalink
Handle the Application.SessionEnding event so that JL can save the cu…
Browse files Browse the repository at this point in the history
…rrent user stats etc., even if the application is being closed due to a user logoff or system shutdown
  • Loading branch information
rampaa committed Jan 21, 2025
1 parent 1d85de2 commit 89661fb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion JL.Windows/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:hc="https://handyorg.github.io/handycontrol"
x:ClassModifier="internal">
x:ClassModifier="internal"
SessionEnding="Application_SessionEnding">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
Expand Down
6 changes: 6 additions & 0 deletions JL.Windows/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,10 @@ private static void LogUnobservedTaskException(object? sender, UnobservedTaskExc
{
Utils.Logger.Fatal(args.Exception, "Unobserved task exception");
}

// ReSharper disable once AsyncVoidMethod
private async void Application_SessionEnding(object sender, SessionEndingCancelEventArgs e)
{
await GUI.MainWindow.Instance.HandleAppClosing().ConfigureAwait(false);
}
}

0 comments on commit 89661fb

Please sign in to comment.