public void Dispose() { _notifyIcon?.Dispose(); _notifyIcon = null; _trayButton?.Dispose(); _trayButton = null; }
/// <inheritdoc /> public void Dispose() { lock (_lock) { _alreadyInitialized = false; NotifyIcon?.Dispose(); NotifyIcon = null; } }
private void App_Exit(object sender, EventArgs e) { if (_notifyIcon != null) { _notifyIcon.Visible = false; _notifyIcon?.Dispose(); _notifyIcon?.Icon?.Dispose(); } }
protected override void Dispose(bool disposing) { if (disposing) { TrayIcon?.Dispose(); } base.Dispose(disposing); }
protected override void Dispose(bool disposing) { if (disposing && (components != null)) { NotifyIcon?.Dispose(); components.Dispose(); } base.Dispose(disposing); }
protected override void Dispose(bool disposing) { if (notifyIcon != null) { notifyIcon.Icon = null; } notifyIcon?.Dispose(); contextMenu1?.Dispose(); base.Dispose(disposing); }
protected override void Dispose(bool disposing) { if (disposing) { _notificationSubject?.Dispose(); _notificationSubject = null; _notification?.Dispose(); _notification = null; } }
private static void Exit(object?sender, EventArgs e) { msdock.Dispose(); if (notifyIcon != null) { notifyIcon.Visible = false; } notifyIcon?.Dispose(); Application.Exit(); }
public override void TryClose(bool?dialogResult = null) { //Properties.Settings.Default.Save(); base.TryClose(dialogResult); if (dialogResult != false) { Ribbon.OnClose(); notifyIcon?.Dispose(); } }
private void notifyIcon_MouseDoubleClick(object sender, MouseEventArgs e) { if (this.WindowState == FormWindowState.Minimized) { this.WindowState = FormWindowState.Normal; this.ShowInTaskbar = true; Show(); _notifyIcon?.Dispose(); _notifyIcon = CreateNotifyIcon(); } }
/// <summary> /// Dispose the app /// </summary> protected override void Dispose(bool disposing) { base.Dispose(disposing); //dispose keymon keyMonitor?.Dispose(); //dispose uis liveStats?.Dispose(); notifyIcon?.Dispose(); }
public override void TryClose(bool?dialogResult = null) { //Properties.Settings.Default.Save(); base.TryClose(dialogResult); if (dialogResult != false) { Ribbon.OnClose(); notifyIcon?.Dispose(); _autoSaveTimer.Enabled = false; AutoSaver.RemoveAll(); } }
private void App_OnExit(object sender, ExitEventArgs e) { //TODO: Use a try catch for each one. MutexList.RemoveAll(); NotifyIcon?.Dispose(); UserSettings.Save(); HotKeyCollection.Default.Dispose(); }
private void App_OnExit(object sender, ExitEventArgs e) { try { MutexList.RemoveAll(); } catch (Exception ex) { LogWriter.Log(ex, "Impossible to remove all mutexes of the opened projects."); } try { NotifyIcon?.Dispose(); } catch (Exception ex) { LogWriter.Log(ex, "Impossible to dispose the system tray icon."); } try { UserSettings.Save(); } catch (Exception ex) { LogWriter.Log(ex, "Impossible to save the user settings."); } try { if (_mutex != null && _accepted) { _mutex.ReleaseMutex(); _accepted = false; } } catch (Exception ex) { LogWriter.Log(ex, "Impossible to release the single instance mutex."); } try { HotKeyCollection.Default.Dispose(); } catch (Exception ex) { LogWriter.Log(ex, "Impossible to dispose the hotkeys."); } }
private async void BeginCycle() { while (true) { try { Application.DoEvents(); CreateIcon(); await Task.Delay(Constants.PollingThreshold); } catch (Exception e) { if (Constants.EnableDebugMode) { MessageBox.Show($"ERROR: {e}", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } _logger.LogError(e.ToString()); trayIcon.Visible = false; trayIcon?.Dispose(); Environment.Exit(0); } } }
protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { trayIcon?.Dispose(); } // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below. // TODO: set large fields to null. disposedValue = true; } }
private async void BeginCycle() { await CheckForMissingReadings(); while (true) { try { Application.DoEvents(); var results = await _fetchService.GetLatestReadings(GlucoseResult?.DateTimeUTC).ConfigureAwait(false); if (results.Any()) { LogResultToDb(results); GlucoseResult = results.Last(); } CreateIcon(); AlertNotification(); await Task.Delay(_options.CurrentValue.PollingThresholdTimeSpan); } catch (Exception e) { if (_options.CurrentValue.EnableDebugMode) { MessageBox.Show($"ERROR: {e}", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } _logger.LogError(e.ToString()); trayIcon.Visible = false; trayIcon?.Dispose(); Environment.Exit(0); } } }
private static void Beenden() { _trayIcon?.Dispose(); _updater?.Dispose(); _identplusclient?.Dispose(); _demoNetMqServer?.Dispose(); if (Application.MessageLoop) { Application.Exit(); // Schließen einer WinForms app } else { Environment.Exit(0); // Schließen einer Console app } }
/// <summary> /// Dispose. /// </summary> protected virtual void Dispose(bool disposing) { devices?.Dispose(); streamingRequestListener?.StopListening(); streamingRequestListener?.Dispose(); Mp3Stream?.Dispose(); NativeMethods.StopSetWindowsHooks(); if (notifyIcon != null) { notifyIcon.Visible = false; } notifyIcon?.Dispose(); mainForm?.Dispose(); taskList?.Dispose(); }
public override void TryClose(bool?dialogResult = null) { //Properties.Settings.Default.Save(); base.TryClose(dialogResult); if (dialogResult != false) { Ribbon.OnClose(); notifyIcon?.Dispose(); AutoSaveTimer.Enabled = false; if (!Application.Current.Properties.Contains("HasCrashed")) { AutoSaver.RemoveAll(); } } }
private static void CloseTrayAppClicked(object sender, EventArgs e) { _logger.Info("Close requested from TrayIcon. Closing..."); try { FormAppList?.Dispose(); TrayIcon?.Dispose(); } catch (Exception ex) { _logger.Error(ex, "Failed to gracefully close application"); } _logger.Info("Application exited"); Environment.Exit(0); }
protected override void Dispose(bool disposing) { if (disposedValue) { return; } if (disposing) { HotkeyManager?.Dispose(); NotifyIcon?.Dispose(); //Dlg?.Dispose(); } disposedValue = true; base.Dispose(disposing); }
public void Command_ExitApplication() { _icon?.Dispose(); var xmlSettings = XmlSettings.FromInstructionSeq(Instructions); xmlSettings.BaseFolder = BaseFolder; _settingsSerializer?.Serialize(xmlSettings, _pathSettings); _prefsSerializer?.Serialize(Preferences, _pathPrefsFile); if (Application.MessageLoop) { Application.Exit(); } else { Environment.Exit(0); } }
private void createNotificaitonIcon() { // this is a hack to fix an issue that is likely related to build 14959 of win10 nIcon?.Dispose(); nIcon = new NotifyIcon { Icon = Properties.Resources.NetDrives, Visible = true }; // Display for 5 seconds. nIcon.DoubleClick += (sender, args) => { this.WindowState = WindowState.Normal; nIcon.Dispose(); }; this.ShowInTaskbar = false; }
private void Dispose(bool disposing) { if (disposed) { return; } if (disposing) { (serviceProvider as IDisposable)?.Dispose(); notifyIcon?.Dispose(); notifyIcon.Icon?.Dispose(); container?.Dispose(); clipboardMonitor?.Dispose(); } CloseHandle(handle); handle = IntPtr.Zero; disposed = true; }
protected override void Dispose(bool disposing) { base.Dispose(disposing); _OnOffMenuItem?.Dispose(); _TrayIcon?.Dispose(); _PropertiesScreen?.Dispose(); if (_MonitorService != null) { _MonitorService.MonitorStatusHasChanged -= _MonitorService_MonitorStatusHasChanged; } _MonitorService?.Dispose(); _MonitorService = null; _OnOffMenuItem = null; _TrayIcon = null; }
/// <summary> /// Dispose all resources. /// </summary> public new void Dispose() { foreach (ConsoleControl.ConsoleControl chat in Chats.Values) { chat?.Dispose(); } SelectedChat = null; Chats = null; ChatLogWatcher?.Dispose(); ChatLogWatcher = null; Reader?.Dispose(); Reader = null; FS?.Dispose(); FS = null; NotifyIcon?.Dispose(); NotifyIcon = null; base.Dispose(); }
public MyApplicationContext() { notifyIcon = new NotifyIcon() { ContextMenuStrip = new ContextMenuStrip { Text = "Open Form" }, Text = "Application", Visible = true, Icon = new Icon("icon.ico") }; appForm = new AppForm(); notifyIcon.DoubleClick += (o, e) => { appForm.Show(); }; RestartRequested += (o, e) => { appForm?.Close(); //Close() will dispose the form as well. notifyIcon?.Dispose(); }; BackgroundWork(); }
private void Dispose(bool disposing) { if (_disposedValue) { return; } if (disposing) { if (_notifyIcon != null) { _notifyIcon?.Dispose(); } if (_formHiding != null) { _formHiding.Dispose(); } if (_viewPureTextInfo != null) { _viewPureTextInfo.Dispose(); } } _disposedValue = true; }
private void Dispose() { _notifyIcon?.Dispose(); _notifyIcon = null; }