public override IMoBiCommand Remove(IMoBiSpatialStructure buildingBlockToRemove, IMoBiProject project, IBuildingBlock buildingBlock, bool silent) { var referringStartValuesBuildingBlocks = project.ReferringStartValuesBuildingBlocks(buildingBlockToRemove); if (referringStartValuesBuildingBlocks.Any()) { throw new MoBiException(AppConstants.CannotRemoveBuildingBlockFromProject(buildingBlockToRemove.Name, referringStartValuesBuildingBlocks.Select(bb => bb.Name))); } return(base.Remove(buildingBlockToRemove, project, buildingBlock, silent)); }
public override IMoBiCommand Remove(TBuildingBlock buildingBlockToRemove, IMoBiProject project, IBuildingBlock buildingBlock, bool silent) { var referringSimulations = project.SimulationsCreatedUsing(buildingBlockToRemove); if (referringSimulations.Any()) { throw new MoBiException(AppConstants.CannotRemoveBuildingBlockFromProject(buildingBlockToRemove.Name, referringSimulations.Select(simulation => simulation.Name))); } return(base.Remove(buildingBlockToRemove, project, buildingBlock, silent)); }