diff --git a/Application/MainWindow/MainWindow.xaml.cs b/Application/MainWindow/MainWindow.xaml.cs index 0333a6e..4893ca2 100644 --- a/Application/MainWindow/MainWindow.xaml.cs +++ b/Application/MainWindow/MainWindow.xaml.cs @@ -54,9 +54,6 @@ public partial class MainWindow : IDisposable // Set up the update handler InitializeUpdate(); - // Show the notification icon - NotificationIcon.Initialize(this); - // Load window settings LoadWindowSettings(); @@ -93,6 +90,16 @@ public partial class MainWindow : IDisposable NewVersionLink.Visibility = Visibility.Visible; } + try + { + // Show the notification icon + NotificationIcon.Initialize(this); + } + catch (Exception e) + { + Log.Logger.Error(e, ""); + } + Log.Logger.Information("MainForm creation finished"); } diff --git a/Application/NotificationIcon.cs b/Application/NotificationIcon.cs index 9648632..b7ec435 100644 --- a/Application/NotificationIcon.cs +++ b/Application/NotificationIcon.cs @@ -19,7 +19,7 @@ internal static class NotificationIcon _notificationIcon = new TaskbarIcon { Icon = Resources.Application }; _notificationIcon.TrayMouseDoubleClick += HandleNotificationIconDoubleClick; - // Setup the menu + // Set up the menu var contextMenu = new ContextMenu(); contextMenu.Opened += HandleContextMenuOpened; @@ -76,7 +76,7 @@ internal static class NotificationIcon public static void Dispose() { // Get rid of the icon - _notificationIcon.Dispose(); + _notificationIcon?.Dispose(); _notificationIcon = null; _mainWindow = null;