private void ButtonReset_Click(object sender, EventArgs e) { if (MessageBox.Show(FormSettings_Localization.SettingsAskResetDefaultValues, TrayTOTP_Plugin_Localization.strTrayTOTPPlugin, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { Working(true, false); //Set controls depending on the state of action. WorkerReset.RunWorkerAsync(); } }
/// <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; } }