public void UnlinkAllAttachments(AnnotationSceneNode annotation) { IEnumerable <SceneElement> attachedElements = annotation.AttachedElements; if (!Enumerable.Any <SceneElement>(attachedElements)) { return; } SceneViewModel viewModel = annotation.ViewModel; using (SceneEditTransaction editTransaction = viewModel.CreateEditTransaction(StringTable.UnlinkAnnotationUndoUnit)) { EnumerableExtensions.ForEach <SceneElement>(attachedElements, (Action <SceneElement>)(element => AnnotationUtils.RemoveAnnotationReference(element, annotation))); AnnotationManagerSceneNode.SetAnnotationParent(annotation, viewModel.RootNode); editTransaction.Commit(); } }
public void UnlinkAttachment(AnnotationSceneNode annotation, SceneElement target) { SceneViewModel viewModel = annotation.ViewModel; using (SceneEditTransaction editTransaction = viewModel.CreateEditTransaction(StringTable.UnlinkAnnotationUndoUnit)) { bool flag = AnnotationUtils.RemoveAnnotationReference(target, annotation); if (target.Equals((object)annotation.Parent)) { flag = true; AnnotationManagerSceneNode.SetAnnotationParent(annotation, viewModel.RootNode); } if (!flag) { return; } editTransaction.Commit(); } }