private void ImgRadioButton_CheckedChanged(object sender, EventArgs e) { if (imgRadioButton.Checked && imgRadioButton.Enabled) { if ((bool)UserConfigManager.GetConfigValueByKey(ConfigKey.IsImgInfoRemind)) { FirstForm_ImgCheckInfo firstForm_ImgCheckInfo = new FirstForm_ImgCheckInfo(); firstForm_ImgCheckInfo.StartPosition = FormStartPosition.Manual; //手動設定跳窗初始位置 firstForm_ImgCheckInfo.Location = new Point(this.Location.X + this.Size.Width / 4, this.Location.Y + this.Size.Height / 4); //跳窗位置 DialogResult dontRemindImgInto = firstForm_ImgCheckInfo.ShowDialog(); bool NoNeedToRemind; if (dontRemindImgInto == DialogResult.Yes) { NoNeedToRemind = true; } else { NoNeedToRemind = false; } UserConfigManager.SetAndWriteConfig(ConfigKey.IsImgInfoRemind, !NoNeedToRemind); } } }
private void ZoomComboBox_SelectedIndexChanged(object sender, EventArgs e) { string tempString = zoomComboBox.Text; int zoomPercentageInt = Convert.ToInt32(tempString.Split('%')[0]); UserConfigManager.SetAndWriteConfig(ConfigKey.ZoomPercentage, zoomPercentageInt); }
public FirstForm() { InitializeComponent(); //委派設定預設值 UserConfigManager.SetDefaultValueToConfigHandler = new UserConfigManager.SetDefaultValueToConfigEvent(SetDefaultValueToConfig); //初始化設定預設值 UserConfigManager.InitConfigDictionary(); }
private void UrlCheckBox_CheckedChanged(object sender, EventArgs e) { bool isChecked = urlCheckBox.Checked; urlRichTextBox.Enabled = isChecked; SourceHTMLRichTextBox.Enabled = !isChecked; youtubeRadioButton.Enabled = isChecked; imgRadioButton.Enabled = isChecked; UserConfigManager.SetAndWriteConfig(ConfigKey.UseUrl, isChecked); }
//設定預設值 private static void SetDefaultValueToConfig() { UserConfigManager.SetConfig(ConfigKey.IsImgInfoRemind, true); UserConfigManager.SetConfig(ConfigKey.UseUrl, false); UserConfigManager.SetConfig(ConfigKey.IsYouTubeChecked, true); UserConfigManager.SetConfig(ConfigKey.IsPreViewAtRight, true); UserConfigManager.SetConfig(ConfigKey.UpOffet, 0); UserConfigManager.SetConfig(ConfigKey.ZoomPercentage, 100); UserConfigManager.SetConfig(ConfigKey.IsBeforePreviewChecked, true); UserConfigManager.SetConfig(ConfigKey.IsAfterPreviewChecked, true); UserConfigManager.SetConfig(ConfigKey.IsCenterChecked, false); }
//依照使用者設定初始化整個版面 private void SettingFirstFormByConfig() { urlCheckBox.Checked = (bool)UserConfigManager.GetConfigValueByKey(ConfigKey.UseUrl); //根據有沒有check來變換其他控制項之Enable UrlCheckBox_CheckedChanged(this, new EventArgs()); youtubeRadioButton.Checked = (bool)UserConfigManager.GetConfigValueByKey(ConfigKey.IsYouTubeChecked); imgRadioButton.Checked = !(bool)UserConfigManager.GetConfigValueByKey(ConfigKey.IsYouTubeChecked); rightSideRadioButton.Checked = (bool)UserConfigManager.GetConfigValueByKey(ConfigKey.IsPreViewAtRight); downRadioButton.Checked = !(bool)UserConfigManager.GetConfigValueByKey(ConfigKey.IsPreViewAtRight); //Proview向上偏移 UpDownOffsetUp.Value = (int)UserConfigManager.GetConfigValueByKey(ConfigKey.UpOffet); zoomComboBox.Text = UserConfigManager.GetConfigValueByKey(ConfigKey.ZoomPercentage).ToString() + "%"; sourcePreviewCheckBox.Checked = (bool)UserConfigManager.GetConfigValueByKey(ConfigKey.IsBeforePreviewChecked); resultPreviewCheckBox.Checked = (bool)UserConfigManager.GetConfigValueByKey(ConfigKey.IsAfterPreviewChecked); centerCheckBox.Checked = (bool)UserConfigManager.GetConfigValueByKey(ConfigKey.IsCenterChecked); }
private void YoutubeRadioButton_CheckedChanged(object sender, EventArgs e) { UserConfigManager.SetAndWriteConfig(ConfigKey.IsYouTubeChecked, youtubeRadioButton.Checked); }
private void RightSideRadioButton_CheckedChanged(object sender, EventArgs e) { UserConfigManager.SetAndWriteConfig(ConfigKey.IsPreViewAtRight, rightSideRadioButton.Checked); }
private void CenterCheckBox_CheckedChanged(object sender, EventArgs e) { UserConfigManager.SetAndWriteConfig(ConfigKey.IsCenterChecked, centerCheckBox.Checked); }
private void resultPreviewCheckBox_CheckedChanged(object sender, EventArgs e) { UserConfigManager.SetAndWriteConfig(ConfigKey.IsAfterPreviewChecked, resultPreviewCheckBox.Checked); }
private void sourcePreviewCheckBox_CheckedChanged(object sender, EventArgs e) { UserConfigManager.SetAndWriteConfig(ConfigKey.IsBeforePreviewChecked, sourcePreviewCheckBox.Checked); }
private void UpDownOffsetUp_ValueChanged(object sender, EventArgs e) { UserConfigManager.SetAndWriteConfig(ConfigKey.UpOffet, (int)UpDownOffsetUp.Value); }