Ejemplo n.º 1
0
        /// <summary>
        /// Called as the Main Form starts to close
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            // We want to tidy up some stuff as this form closes.
            Trace.Listeners.Remove("ClientInfo TraceListener");

            // Close the client info screen
            _clientInfoForm.Hide();

            // Stop the schedule object
            _schedule.Stop();

            // Flush the stats
            _statLog.Flush();

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

            // Flush the logs
            Trace.Flush();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Called as the Main Form starts to close
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MainForm_FormClosing(object sender, FormClosingEventArgs 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();
        }