private void solver_OnSolutionError(object sender, SolutionErrorEventArgs e) { var currentStepImg = this.stepImgs[this.currentIndex]; var currentStep = this.stepLabels[this.currentIndex]; if (currentStepImg.InvokeRequired) currentStepImg.Invoke((MethodInvoker)delegate { currentStepImg.Image = Properties.Resources.cross_icon; }); if (currentStep.InvokeRequired) currentStep.Invoke((MethodInvoker)delegate { currentStep.Text = "Failed"; }); if (this.lblHeader.InvokeRequired) this.lblHeader.Invoke((MethodInvoker)delegate { lblHeader.Text = "Solving error."; }); this.solver.OnSolutionStepCompleted -= this.solver_OnSolutionStepCompleted; }
void solver_OnSolutionError(object sender, SolutionErrorEventArgs e) { PictureBox currentStepImg = stepImgs[currentIndex]; Label currentStep = stepLabels[currentIndex]; if (currentStepImg.InvokeRequired) currentStepImg.Invoke((MethodInvoker)delegate() { currentStepImg.Image = Properties.Resources.cross_icon; }); if (currentStep.InvokeRequired) currentStep.Invoke((MethodInvoker)delegate() { currentStep.Text = "Failed"; }); if (lblHeader.InvokeRequired) lblHeader.Invoke((MethodInvoker)delegate() { lblHeader.Text = "Solving error."; }); solver.OnSolutionStepCompleted -= solver_OnSolutionStepCompleted; }