Example #1
0
 private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     try
     {
         if (monitorPack != null)
         {
             if (monitorPack.BusyPolling) //still busy with previous polling instance
             {
                 //Attempting to abort it.
                 monitorPack.AbortPolling = true;
             }
             if (System.IO.File.Exists(Properties.Settings.Default.LastMonitorPack))
             {
                 monitorPack.Save(Properties.Settings.Default.LastMonitorPack);
             }
             monitorPack.ClosePerformanceCounters();
         }
         ClosePerformanceCounters();
         ToolStripManager.SaveSettings(this, "QuickMon.MainToolbar");
     }
     catch { }
     if (WindowState == FormWindowState.Normal)
     {
         Properties.Settings.Default.MainWindowLocation = this.Location;
         Properties.Settings.Default.MainWindowSize     = this.Size;
     }
     Properties.Settings.Default.Save();
 }