Exemplo n.º 1
0
 private void DeleteCore(IEnumerable <AnnotationSceneNode> annotations)
 {
     ExceptionChecks.CheckNullArgument <IEnumerable <AnnotationSceneNode> >(annotations, "annotations");
     ExceptionChecks.CheckEmptyListArgument <AnnotationSceneNode>(annotations, "annotations");
     foreach (AnnotationSceneNode annotationSceneNode in Enumerable.ToList <AnnotationSceneNode>(annotations))
     {
         foreach (SceneElement element in Enumerable.ToList <SceneElement>(annotationSceneNode.AttachedElements))
         {
             AnnotationUtils.RemoveAnnotationReference(element, annotationSceneNode);
         }
         AnnotationManagerSceneNode.DeleteAnnotation(annotationSceneNode);
     }
 }
Exemplo n.º 2
0
        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();
            }
        }
Exemplo n.º 3
0
        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();
            }
        }