/// <summary> /// Constructor /// </summary> public SettingForm() { try { InitializeComponent(); _checkBoxList.Add(Setting1CheckBox); _checkBoxList.Add(Setting2CheckBox); //_checkBoxList.Add(Setting3CheckBox); _checkBoxList.Add(Setting4CheckBox); _checkBoxList.Add(Setting5CheckBox); int i = 0; foreach (var check in _checkBoxList) { i++; check.CheckedChanged += SettingCheckBox_CheckedChanged; if (SettingInfos.GetInstance().SettingDic[i] == "1") { check.Checked = true; } } } catch (Exception ex) { throw Program.ThrowException(ex); } }
/// <summary> /// 設定値を保存して、閉じる /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SettingForm_FormClosing(object sender, FormClosingEventArgs e) { try { int i = 0; foreach (var check in _checkBoxList) { i++; SettingInfos.GetInstance().CreateSettingValue(i, check.Checked ? "1" : "0"); } SettingInfos.GetInstance().Update(); } catch (Exception ex) { throw Program.ThrowException(ex); } }
/// <summary> /// 処理タイプラジオのクリックイベント /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ProcessTypeRadio_Click(object sender, EventArgs e) { try { if (!DetectRadio.Checked && !KeyboardInputRadio.Checked && !MouseInputRadio.Checked && !WaitRadio.Checked && !MailSendRadio.Checked && !AppStartRadio.Checked && !VariableRadio.Checked && !FileFolderRadio.Checked && !DialogRadio.Checked && !ExcelRadio.Checked) { ((BaseRadioButton)sender).Checked = true; return; } if (((BaseRadioButton)sender).Checked) { return; } if (SettingInfos.GetInstance().SettingDic[1] == "1") { DialogResult result = this.ShowQuestionDialog("処理タイプ変更確認", "処理タイプを変更すると、以前の設定が消去されますが続行しますか?", MessageBoxButtons.YesNo, MessageBoxDefaultButton.Button1); if (result == DialogResult.No) { return; } } DetectRadio.Checked = false; KeyboardInputRadio.Checked = false; MouseInputRadio.Checked = false; WaitRadio.Checked = false; MailSendRadio.Checked = false; AppStartRadio.Checked = false; VariableRadio.Checked = false; FileFolderRadio.Checked = false; DialogRadio.Checked = false; ExcelRadio.Checked = false; ((BaseRadioButton)sender).Checked = true; } catch (Exception ex) { throw Program.ThrowException(ex); } }