예제 #1
0
        public void Dispose()
        {
            _notifyIcon?.Dispose();
            _notifyIcon = null;

            _trayButton?.Dispose();
            _trayButton = null;
        }
예제 #2
0
 /// <inheritdoc />
 public void Dispose()
 {
     lock (_lock)
     {
         _alreadyInitialized = false;
         NotifyIcon?.Dispose();
         NotifyIcon = null;
     }
 }
예제 #3
0
 private void App_Exit(object sender, EventArgs e)
 {
     if (_notifyIcon != null)
     {
         _notifyIcon.Visible = false;
         _notifyIcon?.Dispose();
         _notifyIcon?.Icon?.Dispose();
     }
 }
예제 #4
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                TrayIcon?.Dispose();
            }

            base.Dispose(disposing);
        }
예제 #5
0
 protected override void Dispose(bool disposing)
 {
     if (disposing && (components != null))
     {
         NotifyIcon?.Dispose();
         components.Dispose();
     }
     base.Dispose(disposing);
 }
예제 #6
0
 protected override void Dispose(bool disposing)
 {
     if (notifyIcon != null)
     {
         notifyIcon.Icon = null;
     }
     notifyIcon?.Dispose();
     contextMenu1?.Dispose();
     base.Dispose(disposing);
 }
예제 #7
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         _notificationSubject?.Dispose();
         _notificationSubject = null;
         _notification?.Dispose();
         _notification = null;
     }
 }
예제 #8
0
 private static void Exit(object?sender, EventArgs e)
 {
     msdock.Dispose();
     if (notifyIcon != null)
     {
         notifyIcon.Visible = false;
     }
     notifyIcon?.Dispose();
     Application.Exit();
 }
예제 #9
0
 public override void TryClose(bool?dialogResult = null)
 {
     //Properties.Settings.Default.Save();
     base.TryClose(dialogResult);
     if (dialogResult != false)
     {
         Ribbon.OnClose();
         notifyIcon?.Dispose();
     }
 }
예제 #10
0
 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();
     }
 }
예제 #11
0
파일: App.cs 프로젝트: shadow578/Blaze
        /// <summary>
        /// Dispose the app
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);

            //dispose keymon
            keyMonitor?.Dispose();

            //dispose uis
            liveStats?.Dispose();
            notifyIcon?.Dispose();
        }
예제 #12
0
 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();
     }
 }
예제 #13
0
        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();
        }
예제 #14
0
        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.");
            }
        }
예제 #15
0
 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);
         }
     }
 }
예제 #16
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;
            }
        }
예제 #17
0
        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);
                }
            }
        }
예제 #18
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
     }
 }
예제 #19
0
 /// <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();
 }
예제 #20
0
 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();
         }
     }
 }
예제 #21
0
 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);
        }
예제 #23
0
        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);
            }
        }
예제 #24
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;
 }
예제 #26
0
        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;
        }
예제 #27
0
        /// <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();
        }
예제 #28
0
 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();
 }
예제 #29
0
        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;
        }
예제 #30
0
 private void Dispose()
 {
     _notifyIcon?.Dispose();
     _notifyIcon = null;
 }