Exemple #1
0
        /// <summary>
        /// main window closing - All therds stop
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MainWindow_Closing(object sender, CancelEventArgs e)
        {
            // We want to tidy up some stuff as this form closes.
            Trace.Listeners.Remove("ClientInfo TraceListener");

            try
            {
                // Close the client info screen
                if (_clientInfoForm != null)
                {
                    _clientInfoForm.Hide();
                }

                // Stop the schedule object
                if (_schedule != null)
                {
                    _schedule.Stop();
                }

                // Flush the stats
                if (_statLog != null)
                {
                    _statLog.Flush();
                }

                // Write the CacheManager to disk
                if (_cacheManager != null)
                {
                    _cacheManager.WriteCacheManager();
                }
            }
            catch (NullReferenceException)
            {
                // Stopped before we really started, nothing to do
            }

            // Flush the logs
            Trace.Flush();

            this.root.Children.Clear();

            Environment.Exit(0);
        }
Exemple #2
0
        private void Closing()
        {
            // We want to tidy up some stuff as this form closes.

            // Flush the stats
            _statLog.Flush();

            // Write the CacheManager to disk
            _cacheManager.WriteCacheManager();

            // Flush the logs
            Trace.Flush();
        }