private void DisplayEditComponentDialog(PipeComponent pipeComponent) { PipeComponent clone = new PipeComponent(); CommonUtils.CloneObject(clone, SelectedComponent, ""); clone.PipeComponentType = SelectedComponent.PipeComponentType;//not done by CloneObject method. AddEditPipeComponentDialog dialog = new AddEditPipeComponentDialog(mPipe, pipeComponent); dialog.Show(); dialog.Closed += (s1, e1) => { if (dialog.DialogResult.HasValue && dialog.DialogResult.Value) { Utils.OnCollectionChanged(EventAggregator, mPipe, PROPERTYNAME, true); } else { SelectedComponent.Name = clone.Name; SelectedComponent.PipeComponentType = clone.PipeComponentType; SelectedComponent.Description = clone.Description; } RaisePropertyChanged("Components"); }; }
private void DisplayAddComponentDialog() { AddEditPipeComponentDialog addPipeComponentDialog = new AddEditPipeComponentDialog(mPipe); addPipeComponentDialog.Show(); addPipeComponentDialog.Closed += (s1, e1) => { if (addPipeComponentDialog.DialogResult.HasValue && addPipeComponentDialog.DialogResult.Value) { PipeComponent pc = addPipeComponentDialog.PipeComponent; pc.Pipe = mPipe; pc.PipeId = mPipe.Id; mPipe.PipeComponents.Add(pc); RaisePropertyChanged("Components"); OnCollectionChanged(); RaiseChangeEvent(); } }; }