Exemplo n.º 1
0
        // Minimize to system tray when application is closed.
        protected override void OnClosing(CancelEventArgs e)
        {
            // if hideOnClose
            // setting cancel to true will cancel the close request
            // so the application is not closed
            if (Properties.Settings.Default.hideOnClose && !this.trayClose)
            {
                e.Cancel = true;
                this.Hide();
                base.OnClosing(e);
            }

            if (!Properties.Settings.Default.hideOnClose || this.trayClose)
            {
                ni.Visible = false;
                MouseHook.Stop();
                HotkeysManager.ShutdownSystemHook();
                Properties.Settings.Default.Save();
                if (LogWatcher.WorkerThread != null && LogWatcher.WorkerThread.IsAlive)
                {
                    LogWatcher.StopWatchingLogFile();
                }
                //overlay.Close();
                //stashTabOverlay.Close();
                App.Current.Shutdown();
            }
        }
        public new virtual void Hide()
        {
            IsOpen = false;
            if (LogWatcher.WorkerThread != null && LogWatcher.WorkerThread.IsAlive)
            {
                LogWatcher.StopWatchingLogFile();
            }
            //aTimer.Enabled = false;

            //((MainWindow)System.Windows.Application.Current.MainWindow).RunButtonContent = "Run Overlay";
            base.Hide();
        }