private void AcceptButton_Click(object?sender, EventArgs e) { if (ParentForm == null || HasValidationErrors) { return; } Assertions.IsNotNull(originalRunVersion, nameof(originalRunVersion)); // @formatter:keep_existing_linebreaks true CompetitionRunResult newRunVersion = originalRunVersion .ChangeTimings(ConvertFinishTimeFromScreen(true)) .ChangeFaultCount(ConvertFaultCountFromScreen()) .ChangeRefusalCount(ConvertRefusalCountFromScreen()) .ChangeIsEliminated(ConvertEliminatedFromScreen()); // @formatter:keep_existing_linebreaks restore var changingEventArgs = new RunResultChangingEventArgs(originalRunVersion, newRunVersion); RunResultChanging?.Invoke(this, changingEventArgs); if (changingEventArgs.ErrorMessage == null) { ShowAnimatedSuccess("Competitor updated."); originalRunVersion = CacheManager.DefaultInstance.ActiveModel.GetRunResultFor(newRunVersion.Competitor.Number); RunResultChanged?.Invoke(this, EventArgs.Empty); } else { ShowAnimatedFailure(changingEventArgs.ErrorMessage); } }
private void AcceptButton_Click([CanBeNull] object sender, [NotNull] EventArgs e) { if (ParentForm == null || HasValidationErrors) { return; } CompetitionRunResult originalRunVersionNotNull = AssertOriginalRunVersionNotNull(); CompetitionRunResult newRunVersion = originalRunVersionNotNull.ChangeTimings(ConvertFinishTimeFromScreen(true)) .ChangeFaultCount(ConvertFaultCountFromScreen()) .ChangeRefusalCount(ConvertRefusalCountFromScreen()) .ChangeIsEliminated(ConvertEliminatedFromScreen()); var changingEventArgs = new RunResultChangingEventArgs(originalRunVersionNotNull, newRunVersion); RunResultChanging?.Invoke(this, changingEventArgs); if (changingEventArgs.ErrorMessage == null) { ShowAnimatedSuccess("Competitor updated."); originalRunVersion = CacheManager.DefaultInstance.ActiveModel.GetRunResultFor(newRunVersion.Competitor.Number); RunResultChanged?.Invoke(this, EventArgs.Empty); } else { ShowAnimatedFailure(changingEventArgs.ErrorMessage); } }