private void ExitApplication() { _isExit = true; Close(); _notifyIcon.Dispose(); _notifyIcon = null; }
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(); }
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(); }
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(); }
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(); }
private void Current_Exit(object sender, ExitEventArgs e) { var deck = StreamDeck.OpenDevice(); deck.SetBrightness(50); deck.ShowLogo(); _notifyIcon?.Icon?.Dispose(); _notifyIcon?.Dispose(); }
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; } }
public void Dispose() { //disposing Gekapselt if (Tbi != null) { Tbi.Dispose(); } if (KH != null) { KH.Dispose(); } }
//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(); }
private void Window_Closed(object sender, EventArgs e) { if (updaterThread != null) { updaterThread.Abort(); } if (notifyIcon != null) { notifyIcon.Dispose(); } }
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(); } }
// 当退出时,进行问询 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; } }
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; } }; }
/// <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; } }
private void ExitApplication() { MainWindow?.Close(); trayIcon?.Dispose(); trayIcon = null; Current.Shutdown(); }
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(); }
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(); }), }); }
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; }
protected override void OnExit(ExitEventArgs e) { base.OnExit(e); m_icon.Visible = false; m_icon.Dispose(); PAW01.PAWHost.Stop(); }
/// <summary> /// Cleanup and shutdown the app /// </summary> private void QuitApp() { AppNotificationIcon.Visible = false; AppNotificationIcon.Dispose(); Service?.Stop(); Application.Current.Shutdown(); }
protected override void OnClosing(CancelEventArgs e) { _notiIcon.Visible = false; _notiIcon.Dispose(); base.OnClosing(e); }
private void Window_Closed(object sender, EventArgs e) { Stop(); m_UpdateTimer.Stop(); m_NotifyIcon.Dispose(); m_Loader.Stop(); }
/// <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; } }
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(); } }; }
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; } }
/// <summary> /// what to do on shutdown /// </summary> private void ExitApplication() { isExit = true; mainWindow.Close(); notifyIcon.Dispose(); notifyIcon = null; }
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); }
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(); }; }
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; }
private void Dispose(bool disposing) { if (!disposed) { disposed = true; var notifyIcon = this.notifyIcon; this.notifyIcon = null; if (notifyIcon != null) { notifyIcon.Dispose(); } GC.SuppressFinalize(this); } }
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(); }; }