示例#1
0
 private void ButtonApply_Click(object sender, EventArgs e)
 {
     if (HasErrors())
     {
         return;
     }
     Working(true, true); //Set controls depending on the state of action.
     WorkerSave.RunWorkerAsync();
 }
示例#2
0
 /// <summary>
 /// Windows Form Closing.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void FormSettings_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (WorkerLoad.IsBusy)
     {
         ButtonCancel.Enabled = false;
         WorkerLoad.CancelAsync();
         e.Cancel = true;
     }
     if (WorkerSave.IsBusy)
     {
         ButtonCancel.Enabled = false;
         WorkerSave.CancelAsync();
         e.Cancel = true;
     }
     if (WorkerReset.IsBusy)
     {
         ButtonCancel.Enabled = false;
         WorkerReset.CancelAsync();
         e.Cancel = true;
     }
 }