I\'ve got a .Net 3.5 C# Winforms app. It\'s got no GUI as such, just a NotifyIcon with a ContextMenu.
I\'ve tried to set the NotifyIcon to visible=false and dispose
This is what I'm doing in WPF.
I am using this in conjunction to David Anson's Minimize to tray sample app, which lets you hook up a tray icon to a window (you may have multiple windows open).
Just added this code to the constructor for MinimizeToTrayInstance.
_window.Closed += (s, e) =>
{
if (_notifyIcon != null)
{
_notifyIcon.Visible = false;
_notifyIcon.Dispose();
_notifyIcon = null;
}
};