Skip to content

Commit

Permalink
GuiCommandHandler: Catch exceptions when showing notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianeicher committed Jul 8, 2023
1 parent 44bb4b3 commit f3c7bcf
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/Commands.WinForms/GuiCommandHandler.Notifications.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,17 @@ protected override void DisplayLogEntry(LogSeverity severity, string message)
private void ShowNotification(string title, string message, ToolTipIcon icon = ToolTipIcon.None)
{
void Classic()
=> new NotifyIcon {Visible = true, Text = Branding.Name ?? "Zero Install", Icon = Branding.Icon}
.ShowBalloonTip(10000, title, message, icon);
{
try
{
new NotifyIcon {Visible = true, Text = Branding.Name ?? "Zero Install", Icon = Branding.Icon}
.ShowBalloonTip(10000, title, message, icon);
}
catch (Win32Exception)
{
// Notifications are only shown with best effort
}
}

void Modern(string appId)
{
Expand Down

0 comments on commit f3c7bcf

Please sign in to comment.