コード例 #1
0
        // Override to minimize on X'ing out
        protected override void OnClosing(CancelEventArgs e)
        {
            if (this.Visible && !m_bExit)
            {
                // They used the 'X' on the window, which means they actually want to minimize
                e.Cancel = true;
                SetWindowVisible(false);
            }
            else if (m_bExit)
            {
                // Only stop the service if we've been explicitly told to exit (ie. via the menu)
                m_TimedEventManager.CleanUp();
            }

            // Call base either way
            base.OnClosing(e);
        }