Exemplo n.º 1
0
 private void ShowConfigForm()
 {
     //Check, if ConfigForm is open
     if (configForm == null)
     {
         //if not, make a new instance of FormConfig
         configForm = new FormConfig();
         //show it as a dialog, and check if the input was successful
         DialogResult result = configForm.ShowDialog();
         if (result == DialogResult.OK)
         {
             //now if it was firststart, now it isnt anymore
             firstStart = false;
             //if it was, save everything
             SaveConfig();
             //and apply the settings
             ApplyConfig();
         }
         //destroy the object to know later if the ConfigForm is open
         configForm = null;
         //Exit program after destroying configForm object
         if (result == DialogResult.Cancel)
         {
             ExitProgram();
         }
     }
     else
     {
         //if the ConfigForm is open, bring it to front
         configForm.Activate();
     }
 }
Exemplo n.º 2
0
 public void ExitProgram()
 {
     KillAllThreads();
     //dispose the icon to update the taskbar
     TaskkillerIcon.Dispose();
     //Close Form
     if (configForm != null)
     {
         //Don't show warning
         configForm.DialogResult = DialogResult.OK;
         configForm.Close();
         configForm.Dispose();
         configForm = null;
     }
     Environment.Exit(0);
 }