예제 #1
0
 private void MenuItem_OnClick(object sender, RoutedEventArgs e)
 {
     _managementEventWatcher.Stop();
     _managementEventWatcher.Dispose();
     NotificationIcon.Dispose();
     Application.Current.Shutdown(0);
 }
예제 #2
0
 public override void CloseForm(MainForm form)
 {
     if (_icon != null)
     {
         _icon.Dispose();
         _icon = null;
     }
 }
예제 #3
0
 /// <inheritdoc />
 public void Dispose()
 {
     lock (_lock)
     {
         NotificationIcon?.Dispose();
         NotificationIcon = null;
     }
 }
예제 #4
0
        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;
                }
            }
        }
예제 #6
0
 private void HeadForm_FormClosed(object sender, FormClosedEventArgs e)
 {
     NotificationIcon.Visible = false;
     NotificationIcon.Dispose();
 }