public void Calculate() { Initialize(); while (true) { bool isValid = Validate(); if (isValid) { SolutionFoundEventArgs eva = new SolutionFoundEventArgs(matrix); OnSolutionFound(eva); } bool nextStepSuccess = Increment(matrix.N * matrix.N); if (!nextStepSuccess) { break; } } }
private void OnSolutionFound(SolutionFoundEventArgs e) { EventHandler <SolutionFoundEventArgs> eventHandler = SolutionFound; eventHandler?.Invoke(this, e); }