Index: Ringtoets/Common/src/Ringtoets.Common.IO/FileImporters/StructuresImporter.cs =================================================================== diff -u -ra8d5814e2cb003b85852c499cbc25ca0156887d4 -r207fcf758cac8237b31af99f7f54278b32eba658 --- Ringtoets/Common/src/Ringtoets.Common.IO/FileImporters/StructuresImporter.cs (.../StructuresImporter.cs) (revision a8d5814e2cb003b85852c499cbc25ca0156887d4) +++ Ringtoets/Common/src/Ringtoets.Common.IO/FileImporters/StructuresImporter.cs (.../StructuresImporter.cs) (revision 207fcf758cac8237b31af99f7f54278b32eba658) @@ -24,6 +24,7 @@ using System.Collections.ObjectModel; using System.IO; using System.Linq; +using Core.Common.Base; using Core.Common.Base.Data; using Core.Common.Base.Geometry; using Core.Common.Base.IO; @@ -49,6 +50,7 @@ { private readonly ReferenceLine referenceLine; private readonly IImporterMessageProvider messageProvider; + private IEnumerable updatedInstances; /// /// Initializes a new instance of . @@ -97,8 +99,8 @@ catch (UpdateDataException e) { string message = string.Format(messageProvider.GetUpdateDataFailedLogMessageText( - RingtoetsCommonDataResources.StructureCollection_TypeDescriptor), - e.Message); + RingtoetsCommonDataResources.StructureCollection_TypeDescriptor), + e.Message); Log.Error(message, e); return false; } @@ -116,15 +118,25 @@ Log.Info(message); } + protected override void DoPostImportUpdates() + { + foreach (IObservable updatedInstance in updatedInstances) + { + updatedInstance.NotifyObservers(); + } + base.DoPostImportUpdates(); + } + /// - /// Create structure objects from location and geometry data. + /// Create structure objects from location and geometry data and use this to update the current data model. /// /// The read structure locations. /// The read structure parameters, grouped by location identifier. + /// Collection of all objects that were changed due to the update. /// Thrown when the validation of the structure fails. /// Thrown when updating the structures failed. - protected abstract void CreateSpecificStructures(ICollection structureLocations, - Dictionary> groupedStructureParameterRows); + protected abstract IEnumerable UpdateWithCreatedStructures(ICollection structureLocations, + Dictionary> groupedStructureParameterRows); protected RoundedDouble GetStandardDeviation(StructuresParameterRow structuresParameterRow, string structureName) { @@ -196,7 +208,7 @@ .GroupBy(row => row.LocationId) .ToDictionary(g => g.Key, g => g.ToList()); - CreateSpecificStructures(importStructureLocationsResult.Items, groupedRows); + updatedInstances = UpdateWithCreatedStructures(importStructureLocationsResult.Items, groupedRows); } private ReadResult ReadStructureParameterRowsData()