public PicUpTitle GetData() { var ret = new PicUpTitle(); ret.ReplaceSet.AddRange(textBox_replaceSet.Text.Trim().Split(new string[] { "\r\n" }, StringSplitOptions.None)); ret.TitleSet.AddRange(textBox_titleSet.Text.Trim().Split(new string[] { "\r\n" }, StringSplitOptions.None)); return(ret); }
private void button_TestRun_Click(object sender, RoutedEventArgs e) { PicUpTitle set = GetData(); set.UseCustom = true; string[] list = textbox_TestInput.Text.Split(new string[] { "\r\n" }, StringSplitOptions.None); try { textbox_TestResult.TextWrapping = TextWrapping.NoWrap; textbox_TestResult.Text = string.Join("\r\n", list.Select(s => set.PicUp(s))); } catch (Exception ex) { textbox_TestResult.TextWrapping = TextWrapping.Wrap; textbox_TestResult.Text = ex.Message; } }
public SetPicUpCustomWindow(Visual owner = null, PicUpTitle set = null) { InitializeComponent(); this.Owner = CommonUtil.GetTopWindow(owner); SetData(set); //テスト入力はキャンセル時も保存 textbox_TestInput.Text = testString; this.Closing += (sender, e) => testString = textbox_TestInput.Text; button_ok.Click += (sender, e) => DialogResult = true; button_ReplaceClear.Click += (sender, e) => textBox_replaceSet.Clear(); button_ReplaceCopy.Click += (sender, e) => AddSetData(textBox_replaceSet, PicUpTitle.ReplaceSetDefault); button_TitleClear.Click += (sender, e) => textBox_titleSet.Clear(); button_TitleCopy.Click += (sender, e) => AddSetData(textBox_titleSet, PicUpTitle.TitleSetDefault); button_TestSample.Click += (sender, e) => textbox_TestInput.Text = testStringSample; button_TestClearInput.Click += (sender, e) => textbox_TestInput.Clear(); button_TestClearResult.Click += (sender, e) => textbox_TestResult.Clear(); }
//今は関係無いが、状況によっては set.UseCustom の面倒もちゃんとみないといけない public void SetData(PicUpTitle set) { set = set ?? new PicUpTitle(); textBox_replaceSet.Text = string.Join("\r\n", set.ReplaceSet); textBox_titleSet.Text = string.Join("\r\n", set.TitleSet); }