private void btnOk_Click(object sender, EventArgs e) { bool acceptForm = false; if (useAccidentalDeletionPreventionCheck == false) { acceptForm = true; } else { acceptForm = accidentalDeletionPreventionCheckControl.CheckAcceptanceAndNotifyUser(); if (accidentalDeletionPreventionCheckControl.DisableFurtherChecks) { configuration.SetValue( ConfigurationParameters.DisableAccidentalDeletionPrevention, value: true); configuration.Save(); } } if (acceptForm) { DialogResult = DialogResult.OK; Close(); } }
void SaveSetting <T>(TwoFilesConfiguration configuration, MainSettings savedSettings, string setting, T runningValue) { if (!savedSettings.GetValue(setting).Equals(runningValue)) { configuration.SetValue(setting, runningValue); } }
void SaveListSetting(TwoFilesConfiguration configuration, MainSettings savedSettings, string setting, List <string> runningList) { var savedList = savedSettings.GetValue(setting); if (savedList != null && !savedList.Equals(runningList)) { var listAsString = string.Join(",", runningList); configuration.SetValue(setting, listAsString); } }