private void RaiseMakeRoiSubtractedRoiInteraction() { var contouredStructureList = new ObservableCollection <ListBoxItemViewModel>(); foreach (var c in ContouredStructureNames) { contouredStructureList.Add(new ListBoxItemViewModel { Name = c, IsSelected = false }); } MakeRoiSubtractedRoiRequest.Raise(new MakeRoiSubtractedRoiNotification { Title = "Make ROIs Subtracted ROI", Margin = 0, StructureType = "Control", StructureNames = this.StructureNames, ContouredStructureNames = this.ContouredStructureNames, ContouredStructureList = contouredStructureList, StructureTypes = this.StructureTypes }, r => { if (r.Confirmed && r.BaseStructureName != null && r.SubtractedRoiNames != null) { Message = $"User selected: Base => { r.BaseStructureName}, " + $"Subtracted ROIs => { string.Join(", ", r.SubtractedRoiNames)}"; var roiSubtractedRoiParameters = new RoiSubtractedRoiParameters { StructureName = r.StructureName, StructureType = r.StructureType, BaseStructureName = r.BaseStructureName, SubtractedRoiNames = r.SubtractedRoiNames, Margin = r.Margin }; if (StructureFormulas.Contains(roiSubtractedRoiParameters)) { Message = "The same ROIs subtracted ROI is already in the list"; return; } UpdateStructureNames(r.StructureName); StructureFormulas.Add(roiSubtractedRoiParameters); UpdateStructureDescriptions(); MakeRoiViewModels.Add(new MakeRoiViewModel(roiSubtractedRoiParameters, this)); } else { Message = "User canceled or didn't select structures"; } }); }
private void RaiseMakeWallRoiInteraction() { MakeWallRoiRequest.Raise(new MakeWallRoiNotification { Title = "Make Wall ROI", OuterMargin = 0, InnerMargin = 3, StructureType = "Control", StructureNames = this.StructureNames, ContouredStructureNames = this.ContouredStructureNames, StructureTypes = this.StructureTypes }, r => { if (r.Confirmed && r.BaseStructureName != null) { Message = $"User selected: { r.BaseStructureName}"; var wallRoiParameters = new WallRoiParameters { StructureName = r.StructureName, StructureType = r.StructureType, BaseStructureName = r.BaseStructureName, OuterMargin = r.OuterMargin, InnerMargin = r.InnerMargin }; if (StructureFormulas.Contains(wallRoiParameters)) { Message = "The same wall is already in the list"; return; } UpdateStructureNames(r.StructureName); StructureFormulas.Add(wallRoiParameters); UpdateStructureDescriptions(); MakeRoiViewModels.Add(new MakeRoiViewModel(wallRoiParameters, this)); } else { Message = "User canceled or didn't select structure"; } }); }