private void skinButton1_Click(object sender, EventArgs e) { GenProgressIndicator.Show(); GenProgressIndicator.Start(); ExeAnsTextBox.Visible = false; //——————————————————-// // This is should be a generator ... // //________________________________________// td = new Thread(Generate); td.Start(); }
public void Generate() { try { Configure con = new Configure(CoreMode.ExerciseMode); con.Calc(); } catch (MyException.TooManyException e1) { ErrorForm form = new ErrorForm(e1.Message); form.ShowDialog(); } finally { //这里注意一开始的允许跨线程操纵UI GenProgressIndicator.Hide(); ExeAnsTextBox.Text += "已经生成了" + ReadXml("//Count//FactCount") + "道题目与答案到指定的文件中." + Environment.NewLine; ExeAnsTextBox.Show(); } }