private void MainWindowClosed(object sender, EventArgs e) { if (_notifyIconWrapper != null) { _notifyIconWrapper.Dispose(); _notifyIconWrapper = null; } SaveWindowSettings(); }
private void MainWindowStateChanged(object sender, EventArgs e) { if (WindowState == WindowState.Minimized) { _notifyIconWrapper = new NotifyIconWrapper(this, _showStateForNotifyIcon); UpdateIcon(); ShowInTaskbar = false; } else { if (_notifyIconWrapper != null) { ShowInTaskbar = true; _notifyIconWrapper.Dispose(); _notifyIconWrapper = null; } else { _showStateForNotifyIcon = WindowState; } } }