private void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (e.Error != null) { if (e.Error is CalculationException) { CalculationException ce = e.Error as CalculationException; new StudentsView <StudentScore>(ce.Students, ce.Message).ShowDialog(); } //2016/6/6 穎驊新增DuplicatedSubjectException,用來處理學生在同學期有同樣科目問題。 if (e.Error is DuplicatedSubjectException) { DuplicatedSubjectException dse = e.Error as DuplicatedSubjectException; //new StudentsView<StudentScore>(dse.Students, dse.Message).ShowDialog(); var dialog = new DuplicatedSubject(); dialog.SetList(dse.DuplicatedList); dialog.ShowDialog(); } else { MotherForm.SetStatusBarMessage(""); MsgBox.Show(e.Error.Message); } } else { MotherForm.SetStatusBarMessage("成績計算完成。"); MsgBox.Show("成績計算完成。"); } }
private void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { btnCalc.Enabled = true; MotherForm.SetStatusBarMessage("", 0); if (e.Error != null) { if (e.Error is CalculationException) { CalculationException ce = e.Error as CalculationException; new StudentsView <StudentScore>(ce.Students, ce.Message).ShowDialog(); } else { MsgBox.Show(e.Error.Message); } return; } MsgBox.Show("成績計算完成。"); Close(); }