예제 #1
0
 private void ExitApplication()
 {
     _isExit = true;
     Close();
     _notifyIcon.Dispose();
     _notifyIcon = null;
 }
예제 #2
0
 private void WindowX_Closed(object sender, EventArgs e)
 {
     Tool.Config.Write("H", ((int)this.Height).ToString());
     Tool.Config.Write("W", ((int)this.Width).ToString());
     notifyicon.Dispose();
     Application.Current.Shutdown();
 }
예제 #3
0
 private void menuItem1_Click(object Sender, EventArgs e)
 {
     // Close the form, which closes the application.
     Logger.Debug("Exit selected.");
     nIcon.Visible = false;
     nIcon.Dispose();
     System.Windows.Application.Current.Shutdown();
 }
예제 #4
0
 private void MenuItem_Close_Click(object sender, RoutedEventArgs e)
 {
     if (notifyIcon != null)
     {
         notifyIcon.Dispose();
     }
     Application.Current.Shutdown();
 }
 private void WindowX_Closed(object sender, EventArgs e)
 {
     Tool.Config.Write("H", ((int)Height).ToString());
     Tool.Config.Write("W", ((int)Width).ToString());
     notifyicon.Dispose();
     NoticeManager.ExitNotifiaction();
     Api.StopApi();
     Application.Current.Shutdown();
 }
예제 #6
0
 private void SystemEvents_SessionEnded(object sender, SessionEndedEventArgs e)
 {
     n.QuitMe();
     nIcon.Dispose();
     Settings.WriteSettings(Settings.GetInstance);
     NeighborProtocol.ShutDown = true;
     NeighborProtocol.senderEvent.Set();
     App.Current.Shutdown();
 }
예제 #7
0
        private void Current_Exit(object sender, ExitEventArgs e)
        {
            var deck = StreamDeck.OpenDevice();

            deck.SetBrightness(50);
            deck.ShowLogo();
            _notifyIcon?.Icon?.Dispose();
            _notifyIcon?.Dispose();
        }
예제 #8
0
        private void ListViewMenu_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (((ListViewItem)((ListView)sender).SelectedItem).Name == "Menu")
            {
                return;
            }
            GridMain.Children.Clear();

            switch (((ListViewItem)((ListView)sender).SelectedItem).Name)
            {
            case "ItemHome":
                GridMain.Children.Add(uscDashboard);
                break;

            case "ItemCreate":
                GridMain.Children.Add(uscAudit);
                break;

            case "Server":
                GridMain.Children.Add(server);
                break;

            case "Net":
                GridMain.Children.Add(net);
                break;

            case "Chat":
                GridMain.Children.Add(chatControl);
                chatControl.dtgClients.ItemsSource = server.dtgClients.Items;
                chatControl.dtgClients.Items.Refresh();
                break;

            case "Settings":
                GridMain.Children.Add(stgServer);
                break;

            case "Logout":
                BtnLogout();
                break;

            case "Quit":
                Application.Current.Shutdown();
                notifyIcon.Dispose();
                break;

            default:
                break;
            }
            if (tgl.IsChecked.Value)
            {
                tgl.IsChecked = !tgl.IsChecked;
            }
        }
예제 #9
0
 public void Dispose()
 {
     //disposing Gekapselt
     if (Tbi != null)
     {
         Tbi.Dispose();
     }
     if (KH != null)
     {
         KH.Dispose();
     }
 }
예제 #10
0
 //setting app tray item clicked
 private void Setting(object sender, EventArgs e)
 {
     //restoring window state after left mouse click on the tray icon
     this.WindowState   = WindowState.Normal;
     this.ShowInTaskbar = true;
     //focus the app after being restored from the tray
     this.Activate();
     //showing the setting tab user control
     gridMenu.Children.Clear();
     gridMenu.Children.Add(new SettingsUserControl());
     IconNotify.Dispose();
 }
예제 #11
0
        private void Window_Closed(object sender, EventArgs e)
        {
            if (updaterThread != null)
            {
                updaterThread.Abort();
            }

            if (notifyIcon != null)
            {
                notifyIcon.Dispose();
            }
        }
예제 #12
0
 protected override void OnClosing(CancelEventArgs e)
 {
     if (HideMainWin)
     {
         e.Cancel = HideMainWin;
         this.Hide();
         ni.ShowBalloonTip(5000, "Minimized", "UI Automator is still running.", System.Windows.Forms.ToolTipIcon.Info);
     }
     else
     {
         ni.Dispose();
     }
 }
예제 #13
0
 // 当退出时,进行问询
 private void Window_Closing(object sender, CancelEventArgs e)
 {
     if (System.Windows.MessageBox.Show("退出弹幕派?", "弹幕派",
                                        MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes)
     {
         notifyIcon.Dispose();
         System.Windows.Application.Current.Shutdown();
     }
     else
     {
         e.Cancel = true;
     }
 }
예제 #14
0
        private void CreateTrayIcon()
        {
            System.Windows.Forms.NotifyIcon ni = new System.Windows.Forms.NotifyIcon();
#if DEBUG
            ni.Icon = Properties.Resources.debugicon;
#else
            ni.Icon = Properties.Resources.icon;
#endif

            ni.Visible      = true;
            ni.DoubleClick +=
                (s, e) =>
            {
                this.Show();
                this.WindowState = WindowState.Normal;
            };
            this.Closed +=
                (s, e) =>
            {
                if (ni != null)
                {
                    ni.Visible = false;
                    ni.Dispose();
                    ni = null;
                }
            };
        }
예제 #15
0
        /// <summary>
        /// Called to dispose the object.
        /// </summary>
        /// <param name="disposing">Dispose managed objects</param>
        /// <remarks>
        /// To release resources for inherited classes, override this method.
        /// Call <c>base.Dispose(disposing)</c> within it to release parent class resources, and release child class resources if <paramref name="disposing"/> parameter is <c>true</c>.
        /// This method can get called multiple times for the same object instance. When the child specific resources should be released only once, introduce a flag to detect redundant calls.
        /// </remarks>
        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    if (NotifyIcon != null)
                    {
                        NotifyIcon.Dispose();
                    }

                    if (Icons != null)
                    {
                        foreach (var i in Icons)
                        {
                            if (i.Value != null)
                            {
                                i.Value.Dispose();
                            }
                        }
                    }
                }

                disposedValue = true;
            }
        }
예제 #16
0
 private void ExitApplication()
 {
     MainWindow?.Close();
     trayIcon?.Dispose();
     trayIcon = null;
     Current.Shutdown();
 }
예제 #17
0
        public static void MinimizeToTray(MainWindow window, System.ComponentModel.CancelEventArgs e)
        {
            e.Cancel = true;
            window.Hide();

            if (_notifyIcon != null)
            {
                _notifyIcon.Dispose();
            }
            _notifyIcon              = new System.Windows.Forms.NotifyIcon();
            _notifyIcon.DoubleClick += (s, args) => ShowMainWindow(window);
            _notifyIcon.Icon         = WallpaperWeather.Properties.Resources.Icon1; //<--- icon noch ändern
            _notifyIcon.Visible      = true;

            CreateContextMenu(window);
        }
        private void Application_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            ni.Dispose();
            ni = null;

            Process.GetCurrentProcess().Kill();
        }
예제 #19
0
        public MainWindow()
        {
            InitializeComponent();

            screenCaputre.ScreenCaputred += OnScreenCaputred;

            notifyIcon              = new System.Windows.Forms.NotifyIcon();
            notifyIcon.Icon         = System.Drawing.Icon.ExtractAssociatedIcon(System.Windows.Forms.Application.ExecutablePath);
            notifyIcon.Text         = "豆腐OCR截屏";
            notifyIcon.Visible      = true;
            notifyIcon.DoubleClick += capture;
            //图标右键菜单
            notifyIcon.ContextMenu = new System.Windows.Forms.ContextMenu(new[]
            {
                new System.Windows.Forms.MenuItem("设置API接口", (sender, args) =>
                {
                    Visibility    = Visibility.Visible;
                    ShowInTaskbar = true;
                }),
                new System.Windows.Forms.MenuItem("退出程序", (sender, args) =>
                {
                    Application.Current.Shutdown();
                    notifyIcon.Dispose();
                }),
            });
        }
예제 #20
0
 public void ExitApplication()
 {
     isExit = true;
     MainWindow.Close();
     notifyIcon.Dispose();
     notifyIcon = null;
 }
        public MainWindowViewModel()
        {
            contextMenu           = new ContextMenu();
            contextMenu.Placement = System.Windows.Controls.Primitives.PlacementMode.MousePoint;

            MenuItem item = new MenuItem()
            {
                Header = "종료"
            };

            item.Click += (s, e) =>
            {
                notifyIcon.Dispose();
                Application.Current.Shutdown();
            };
            contextMenu.Items.Add(item);


            notifyIcon              = new System.Windows.Forms.NotifyIcon();
            notifyIcon.Text         = "Auto Input";
            notifyIcon.MouseDown   += NotifyIcon_MouseDown;
            notifyIcon.DoubleClick += NotifyIcon_DoubleClick;

            using (Stream s = Application.GetResourceStream(new Uri("Resources/Icon.ico", UriKind.Relative)).Stream)
                notifyIcon.Icon = new System.Drawing.Icon(s);
            notifyIcon.Visible = true;

            // initialize app init
            activeAlertPanel      = new TransparentWindow();
            activeAlertPanel.Left = 20;
            activeAlertPanel.Top  = 20;

            ((App)Application.Current).ClickExecutor.OnClickEnableChanged += ClickExecutor_OnClickEnableChanged;
        }
예제 #22
0
파일: App.xaml.cs 프로젝트: v-yadli/PAW-01
 protected override void OnExit(ExitEventArgs e)
 {
     base.OnExit(e);
     m_icon.Visible = false;
     m_icon.Dispose();
     PAW01.PAWHost.Stop();
 }
예제 #23
0
 /// <summary>
 /// Cleanup and shutdown the app
 /// </summary>
 private void QuitApp()
 {
     AppNotificationIcon.Visible = false;
     AppNotificationIcon.Dispose();
     Service?.Stop();
     Application.Current.Shutdown();
 }
예제 #24
0
        protected override void OnClosing(CancelEventArgs e)
        {
            _notiIcon.Visible = false;
            _notiIcon.Dispose();

            base.OnClosing(e);
        }
예제 #25
0
 private void Window_Closed(object sender, EventArgs e)
 {
     Stop();
     m_UpdateTimer.Stop();
     m_NotifyIcon.Dispose();
     m_Loader.Stop();
 }
예제 #26
0
        /// <summary>
        /// Called to dispose the object.
        /// </summary>
        /// <param name="disposing">Dispose managed objects</param>
        /// <remarks>
        /// To release resources for inherited classes, override this method.
        /// Call <c>base.Dispose(disposing)</c> within it to release parent class resources, and release child class resources if <paramref name="disposing"/> parameter is <c>true</c>.
        /// This method can get called multiple times for the same object instance. When the child specific resources should be released only once, introduce a flag to detect redundant calls.
        /// </remarks>
        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    if (_tray_icon != null)
                    {
                        _tray_icon.Dispose();
                    }

                    if (_icons != null)
                    {
                        foreach (var i in _icons)
                        {
                            if (i.Value != null)
                            {
                                i.Value.Dispose();
                            }
                        }
                    }
                }

                disposedValue = true;
            }
        }
예제 #27
0
        public ConsoleWindow()
        {
            InitializeComponent();

            LogsTab.DataContext     = ConsoleViewModel.Instance;
            SettingsTab.DataContext = SettingsViewModel.Instance;

            TrayIcon = new System.Windows.Forms.NotifyIcon
            {
                Icon    = System.Drawing.Icon.ExtractAssociatedIcon(System.Windows.Forms.Application.ExecutablePath),
                Visible = true
            };

            Closed += (s, e) => TrayIcon.Dispose();

            var contextMenu = new System.Windows.Forms.ContextMenu();

            contextMenu.MenuItems.Add("E&xit", (s, e) => Close());
            TrayIcon.ContextMenu = contextMenu;

            TrayIcon.DoubleClick += (s, e) =>
            {
                if (IsEnabled)
                {
                    MinimizeToTray();
                }
                else
                {
                    Restore();
                }
            };
        }
예제 #28
0
 private void MetroWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (DataUtil.Config.sysConfig.exitConfirm && MessageBox.Show("是否确定要退出团长助理?", "退出确认", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No)
     {
         e.Cancel = true;
         return;
     }
     timerCheck.Dispose();
     timerClock.Dispose();
     timerAuto.Dispose();
     if (DataUtil.Config.sysConfig.enableHotKey)
     {
         IntPtr handle = new WindowInteropHelper(this).Handle;
         HotKeyHelper.UnregisterHotKey(handle, HotKeyHelper.hotKeyId);
     }
     if (SoundHelper.isMute)
     {
         SoundHelper.Mute();
     }
     if (notifyIcon != null)
     {
         notifyIcon.Dispose();
         notifyIcon = null;
     }
 }
예제 #29
0
 /// <summary>
 /// what to do on shutdown
 /// </summary>
 private void ExitApplication()
 {
     isExit = true;
     mainWindow.Close();
     notifyIcon.Dispose();
     notifyIcon = null;
 }
예제 #30
0
        protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
        {
            // close Spotify first
            if (SettingsXml.Current.CloseSpotifyWithToastify)
            {
                Spotify.KillSpotify();
            }

            // Ensure trayicon is removed on exit. (Thx Linus)
            trayIcon.Visible = false;
            trayIcon.Dispose();
            trayIcon = null;

            // Let the plugins now we're closing up.
            // we do this last since it's transparent to the user
            foreach (var p in this.Plugins)
            {
                try
                {
                    p.Closing();
                    p.Dispose();
                }
                catch (Exception)
                {
                    //For now we swallow any plugin errors.
                }
            }

            this.Plugins.Clear();

            base.OnClosing(e);
        }
예제 #31
0
        private static void SetupTrayIcon(string logFileName)
        {
            // Create tray icon
            var components = new System.ComponentModel.Container();

            var notifyIcon = new System.Windows.Forms.NotifyIcon(components);
            notifyIcon.Text = "Xenko Connection Router";
            notifyIcon.Icon = Properties.Resources.Logo;
            notifyIcon.Visible = true;
            notifyIcon.ContextMenu = new System.Windows.Forms.ContextMenu();

            if (!string.IsNullOrEmpty(logFileName))
            {
                var showLogMenuItem = new System.Windows.Forms.MenuItem("Show &Log");
                showLogMenuItem.Click += (sender, args) => OnShowLogClick(logFileName);
                notifyIcon.ContextMenu.MenuItems.Add(showLogMenuItem);

                notifyIcon.BalloonTipClicked += (sender, args) => OnShowLogClick(logFileName);
            }

            var openConsoleMenuItem = new System.Windows.Forms.MenuItem("Open Console");
            openConsoleMenuItem.Click += (sender, args) => OnOpenConsoleClick((System.Windows.Forms.MenuItem)sender);
            notifyIcon.ContextMenu.MenuItems.Add(openConsoleMenuItem);

            var exitMenuItem = new System.Windows.Forms.MenuItem("E&xit");
            exitMenuItem.Click += (sender, args) => OnExitClick();
            notifyIcon.ContextMenu.MenuItems.Add(exitMenuItem);

            GlobalLogger.GlobalMessageLogged += (logMessage) =>
            {
                // Log only warning, errors and more
                if (logMessage.Type < LogMessageType.Warning)
                    return;

                var toolTipIcon = logMessage.Type < LogMessageType.Error ? System.Windows.Forms.ToolTipIcon.Warning : System.Windows.Forms.ToolTipIcon.Error;

                // Display notification (for two second)
                notifyIcon.ShowBalloonTip(2000, "Xenko Connection Router", logMessage.ToString(), toolTipIcon);
            };

            System.Windows.Forms.Application.ApplicationExit += (sender, e) =>
            {
                notifyIcon.Visible = false;
                notifyIcon.Icon = null;
                notifyIcon.Dispose();
            };
        }
예제 #32
0
 private void InitializeNotifyIcon()
 {
     NotifyIcon = new System.Windows.Forms.NotifyIcon
     {
         Text = "Patchy",
         Icon = new System.Drawing.Icon(Application.GetResourceStream(
             new Uri("pack://application:,,,/Patchy;component/Images/patchy.ico" )).Stream),
         Visible = true
     };
     NotifyIcon.DoubleClick += NotifyIconClick;
     NotifyIcon.BalloonTipClicked += NotifyIconBalloonTipClicked;
     var menu = new System.Windows.Forms.ContextMenu();
     menu.MenuItems.Add("Add Torrent", (s, e) => ExecuteNew(null, null));
     menu.MenuItems.Add("Exit", (s, e) =>
     {
         NotifyIcon.Dispose();
         AllowClose = true;
         Close();
     });
     NotifyIcon.ContextMenu = menu;
 }
예제 #33
0
 private void Dispose(bool disposing)
 {
     if (!disposed)
     {
         disposed = true;
         var notifyIcon = this.notifyIcon;
         this.notifyIcon = null;
         if (notifyIcon != null)
         {
             notifyIcon.Dispose();
         }
         GC.SuppressFinalize(this);
     }
 }
예제 #34
0
파일: Program.cs 프로젝트: ItayGal2/paradox
        private static void SetupTrayIcon(string logFileName)
        {
            // Create tray icon
            var components = new System.ComponentModel.Container();

            var notifyIcon = new System.Windows.Forms.NotifyIcon(components);
            notifyIcon.Text = "Paradox Connection Router";
            notifyIcon.Icon = Properties.Resources.Logo;
            notifyIcon.Visible = true;
            notifyIcon.ContextMenu = new System.Windows.Forms.ContextMenu();

            if (!string.IsNullOrEmpty(logFileName))
            {
                var showLogMenuItem = new System.Windows.Forms.MenuItem("Show &Log");
                showLogMenuItem.Click += (sender, args) => OnShowLogClick(logFileName);
                notifyIcon.ContextMenu.MenuItems.Add(showLogMenuItem);

                notifyIcon.BalloonTipClicked += (sender, args) => OnShowLogClick(logFileName);
            }

            var openConsoleMenuItem = new System.Windows.Forms.MenuItem("Open Console");
            openConsoleMenuItem.Click += (sender, args) => OnOpenConsoleClick((System.Windows.Forms.MenuItem)sender);
            notifyIcon.ContextMenu.MenuItems.Add(openConsoleMenuItem);

            var exitMenuItem = new System.Windows.Forms.MenuItem("E&xit");
            exitMenuItem.Click += (sender, args) => OnExitClick();
            notifyIcon.ContextMenu.MenuItems.Add(exitMenuItem);

            GlobalLogger.GlobalMessageLogged += (logMessage) =>
            {
                System.Windows.Forms.ToolTipIcon toolTipIcon;
                switch (logMessage.Type)
                {
                    case LogMessageType.Debug:
                    case LogMessageType.Verbose:
                    case LogMessageType.Info:
                        toolTipIcon = System.Windows.Forms.ToolTipIcon.Info;
                        break;
                    case LogMessageType.Warning:
                        toolTipIcon = System.Windows.Forms.ToolTipIcon.Warning;
                        break;
                    case LogMessageType.Error:
                    case LogMessageType.Fatal:
                        toolTipIcon = System.Windows.Forms.ToolTipIcon.Error;
                        break;
                    default:
                        throw new ArgumentOutOfRangeException();
                }

                // Display notification (for one second)
                notifyIcon.ShowBalloonTip(2000, "Paradox Connection Router", logMessage.ToString(), toolTipIcon);
            };

            System.Windows.Forms.Application.ApplicationExit += (sender, e) =>
            {
                notifyIcon.Visible = false;
                notifyIcon.Icon = null;
                notifyIcon.Dispose();
            };
        }