From 973bf7f284ea8d337163c0875dd7f0098ffdd062 Mon Sep 17 00:00:00 2001 From: Jeremy Tellier - ROG Date: Thu, 25 Mar 2021 19:55:29 +0100 Subject: [PATCH] Remove Icon on exit for Sheilds bug --- DesktopEdge/MainWindow.xaml.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/DesktopEdge/MainWindow.xaml.cs b/DesktopEdge/MainWindow.xaml.cs index 24a2d260..04bc05fc 100644 --- a/DesktopEdge/MainWindow.xaml.cs +++ b/DesktopEdge/MainWindow.xaml.cs @@ -314,6 +314,7 @@ namespace ZitiDesktopEdge { App.Current.MainWindow.WindowState = WindowState.Normal; App.Current.MainWindow.Deactivated += MainWindow_Deactivated; App.Current.MainWindow.Activated += MainWindow_Activated; + App.Current.Exit += Current_Exit; this.components = new System.ComponentModel.Container(); @@ -343,6 +344,16 @@ namespace ZitiDesktopEdge { IdentityMenu.OnMessage += IdentityMenu_OnMessage; } + + private void Current_Exit(object sender, ExitEventArgs e) { + if (notifyIcon != null) { + notifyIcon.Visible = false; + notifyIcon.Icon.Dispose(); + notifyIcon.Dispose(); + notifyIcon = null; + } + } + private void contextMenuItem_Click(object Sender, EventArgs e) { this.Close(); }