private void manager_ExecutionStatusChange(object sender, ExecutionStatusEventArgs e) { ExecutionStatus currentStatus = e.ExecutionStatus; if (currentStatus == ExecutionStatus.Success || currentStatus == ExecutionStatus.Failed || currentStatus == ExecutionStatus.Stopped) { FreezeGridButtons(); SetButtonEnabled(stopBtn, false); SetButtonEnabled(pauseBtn, false); SetButtonEnabled(startBtn, false); SetButtonEnabled(continueBtn, false); if (currentStatus == ExecutionStatus.Success) { toolStripLabel1.Text = "Saving results..."; SessionController.SaveResults(jobName); toolStripLabel1.Text = ""; MessageBox.Show("Calculation has completed successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (currentStatus == ExecutionStatus.Stopped) { MessageBox.Show("Calculation has stopped by user", "Stopped", MessageBoxButtons.OK, MessageBoxIcon.Information); if (SessionController.GetResultsCount(jobName) != 0) { toolStripLabel1.Text = "Saving results..."; SessionController.SaveResults(jobName); toolStripLabel1.Text = ""; } } else if (currentStatus == ExecutionStatus.Failed) { MessageBox.Show("Calculation has failed", "Fail", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
// Защищенная часть. protected void OnExecutionStatusChange(ExecutionStatusEventArgs args) { CurrentExecutionStatus = args.ExecutionStatus; if (ExecutionStatusChange != null) { ExecutionStatusChange(this, args); } }