Skip to content

Commit

Permalink
add check can do before run
Browse files Browse the repository at this point in the history
  • Loading branch information
studyzy committed May 5, 2019
1 parent 0880a1f commit 6597410
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/IME WL Converter Win/Forms/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
}
Expand Down

0 comments on commit 6597410

Please sign in to comment.