private void MenuItem_OnClick(object sender, RoutedEventArgs e) { _managementEventWatcher.Stop(); _managementEventWatcher.Dispose(); NotificationIcon.Dispose(); Application.Current.Shutdown(0); }
public override void CloseForm(MainForm form) { if (_icon != null) { _icon.Dispose(); _icon = null; } }
/// <inheritdoc /> public void Dispose() { lock (_lock) { NotificationIcon?.Dispose(); NotificationIcon = null; } }
private void Exit_Click(object sender, EventArgs e) { NotificationIcon.Visible = false; NotificationIcon.Dispose(); _cts.Cancel(); Application.Exit(); }
static void Main(string[] args) { NotificationManager.Initialize("com.app.test", "App Test", icon_path); NotificationManager.SendNotification("My New Notification", "Isn't This Handy", "ActionId", icon_path); NotificationManager.NotificationIconSelectedEvent += NotificationManager_NotificationIconSelectedEvent; var trayIcon = new NotificationIcon(icon_path); trayIcon.NotificationIconSelected += TrayIcon_NotificationIconSelected; while (true) { trayIcon?.DoMessageLoop(true); if (destroy) { trayIcon?.Dispose(); trayIcon = null; } } }
private void HeadForm_FormClosed(object sender, FormClosedEventArgs e) { NotificationIcon.Visible = false; NotificationIcon.Dispose(); }