From 65974108c54e7bb0a47f6ab4f559b966bf7b79c3 Mon Sep 17 00:00:00 2001 From: Devin Date: Mon, 6 May 2019 00:35:55 +0800 Subject: [PATCH] add check can do before run --- src/IME WL Converter Win/Forms/MainForm.cs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/IME WL Converter Win/Forms/MainForm.cs b/src/IME WL Converter Win/Forms/MainForm.cs index 7cbbfa66..ac4b5e9f 100644 --- a/src/IME WL Converter Win/Forms/MainForm.cs +++ b/src/IME WL Converter Win/Forms/MainForm.cs @@ -176,9 +176,27 @@ private void btnOpenFileDialog_Click(object sender, EventArgs e) } } } + private bool CheckCanRun() + { + if(import==null || export==null) + { + MessageBox.Show("请先选择导入词库类型和导出词库类型"); + return false; + } + if(this.txbWLPath.Text=="") + { + MessageBox.Show("请先选择源词库文件"); + return false; + } + return true; + } private void btnConvert_Click(object sender, EventArgs e) { + if (!CheckCanRun()) + { + return; + } richTextBox1.Clear(); try @@ -211,7 +229,9 @@ private void btnConvert_Click(object sender, EventArgs e) mainBody.BatchFilters = GetBatchFilters(); mainBody.ReplaceFilters = GetReplaceFilters(); - mainBody.ProcessNotice+=new ProcessNotice((string notice) => { richTextBox1.AppendText(notice);}); + mainBody.ProcessNotice+=new ProcessNotice((string notice) => { + richTextBox1.Invoke(new Action(() => richTextBox1.AppendText(notice + "\r\n"))); + }); timer1.Enabled = true; backgroundWorker1.RunWorkerAsync(); }