Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsWaveHeightLocationsView.cs =================================================================== diff -u -rf5bac1f11df4ee4881109371c50120763e303642 -r1b9d535d0b4f21bd0adb64184e5273d8bf691c4e --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsWaveHeightLocationsView.cs (.../GrassCoverErosionOutwardsWaveHeightLocationsView.cs) (revision f5bac1f11df4ee4881109371c50120763e303642) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsWaveHeightLocationsView.cs (.../GrassCoverErosionOutwardsWaveHeightLocationsView.cs) (revision 1b9d535d0b4f21bd0adb64184e5273d8bf691c4e) @@ -29,6 +29,7 @@ using Ringtoets.GrassCoverErosionOutwards.Forms.PresentationObjects; using Ringtoets.GrassCoverErosionOutwards.Forms.Properties; using Ringtoets.GrassCoverErosionOutwards.Service.MessageProviders; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; namespace Ringtoets.GrassCoverErosionOutwards.Forms.Views { @@ -37,14 +38,19 @@ /// for the public class GrassCoverErosionOutwardsWaveHeightLocationsView : HydraulicBoundaryLocationsView { - private readonly Observer hydraulicBoundaryLocationObserver; + private readonly Observer assessmentSectionObserver; + private readonly Observer hydraulicBoundaryLocationsObserver; + private IAssessmentSection assessmentSection; + private GrassCoverErosionOutwardsFailureMechanism failureMechanism; + /// /// Creates a new instance of /// public GrassCoverErosionOutwardsWaveHeightLocationsView() { - hydraulicBoundaryLocationObserver = new Observer(UpdateHydraulicBoundaryLocations); + assessmentSectionObserver = new Observer(UpdateCalculateForSelectedButton); + hydraulicBoundaryLocationsObserver = new Observer(UpdateHydraulicBoundaryLocations); } public override object Data @@ -57,17 +63,39 @@ { var data = (ObservableList) value; base.Data = data; - hydraulicBoundaryLocationObserver.Observable = data; + hydraulicBoundaryLocationsObserver.Observable = data; } } - public override IAssessmentSection AssessmentSection { get; set; } + public override IAssessmentSection AssessmentSection + { + get + { + return assessmentSection; + } + set + { + assessmentSection = value; + assessmentSectionObserver.Observable = assessmentSection; + } + } /// /// Gets or sets the for which the /// hydraulic boundary locations are shown. /// - public GrassCoverErosionOutwardsFailureMechanism FailureMechanism { get; set; } + public GrassCoverErosionOutwardsFailureMechanism FailureMechanism + { + get + { + return failureMechanism; + } + set + { + failureMechanism = value; + UpdateCalculateForSelectedButton(); + } + } protected override WaveHeightLocationRow CreateNewRow(HydraulicBoundaryLocation location) { @@ -114,10 +142,21 @@ protected override void Dispose(bool disposing) { - hydraulicBoundaryLocationObserver.Dispose(); + assessmentSectionObserver.Dispose(); + hydraulicBoundaryLocationsObserver.Dispose(); base.Dispose(disposing); } + protected override string ValidateCalculatableObjects() + { + if (FailureMechanism != null && FailureMechanism.Contribution <= 0) + { + return RingtoetsCommonFormsResources.Contribution_of_failure_mechanism_zero; + } + + return base.ValidateCalculatableObjects(); + } + private void UpdateHydraulicBoundaryLocations() { if (IsDataGridDataSourceChanged())