Skip to content

Commit

Permalink
Handle default toast notification activation case and default main wi…
Browse files Browse the repository at this point in the history
…ndow to hide at start.
  • Loading branch information
leonzhou-smokeball committed Dec 20, 2024
1 parent 29e4830 commit 2ad4f2c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion App/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,14 @@ protected override void OnExit(ExitEventArgs e)
private void OnToastNotificationActivatedAsync(ToastNotificationActivatedEventArgsCompat toastArgs)
{
var arguments = ToastArguments.Parse(toastArgs.Argument);
if (!arguments.TryGetActionArgument(out var action)) return;
if (!arguments.TryGetActionArgument(out var action))
{
// When there's no action from toast notification activation, this is most likely triggered by users
// clicking the entire notification instead of an individual button.
// Show the details view in this case.
Dispatcher.InvokeAsync(() => ActivateMainWindow().NavigateToPage<DetailsPage>());
}

switch (action)
{
case ToastNotificationExtensions.Action.ViewDetails:
Expand Down
2 changes: 1 addition & 1 deletion App/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion App/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<Value Profile="(Default)" />
</Setting>
<Setting Name="HideAtStartup" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="TrayIconFontFamily" Type="System.Windows.Media.FontFamily" Scope="User">
<Value Profile="(Default)">Microsoft Sans Serif</Value>
Expand Down

0 comments on commit 2ad4f2c

Please sign in to comment.