예제 #1
0
        public void CopyToClipboardAsText(IEnumerable <AnnotationSceneNode> annotations)
        {
            ExceptionChecks.CheckNullArgument <IEnumerable <AnnotationSceneNode> >(annotations, "annotations");
            ExceptionChecks.CheckEmptyListArgument <AnnotationSceneNode>(annotations, "annotations");
            FlowDocument flowDoc = this.GenerateFlowDocument(annotations);
            DataObject   dataObj = new DataObject();

            this.SaveFlowDocIntoDataObject(flowDoc, dataObj, DataFormats.Rtf);
            this.SaveFlowDocIntoDataObject(flowDoc, dataObj, DataFormats.Text);
            Clipboard.SetDataObject((object)dataObj);
        }
예제 #2
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);
     }
 }
예제 #3
0
        public FlowDocument GenerateFlowDocument(IEnumerable <RawAnnotation> annotations)
        {
            ExceptionChecks.CheckNullArgument <IEnumerable <RawAnnotation> >(annotations, "annotations");
            ExceptionChecks.CheckEmptyListArgument <RawAnnotation>(annotations, "annotations");
            FlowDocument flowDocument = new FlowDocument();

            foreach (RawAnnotation annotation in annotations)
            {
                flowDocument.Blocks.Add((Block) new CopyAnnotationTextTemplate(annotation));
                flowDocument.Blocks.Add((Block) new Section((Block) new Paragraph()));
            }
            flowDocument.Blocks.Remove(Enumerable.Last <Block>((IEnumerable <Block>)flowDocument.Blocks));
            return(flowDocument);
        }
예제 #4
0
        public void Delete(IEnumerable <AnnotationSceneNode> annotations)
        {
            ExceptionChecks.CheckNullArgument <IEnumerable <AnnotationSceneNode> >(annotations, "annotations");
            ExceptionChecks.CheckEmptyListArgument <AnnotationSceneNode>(annotations, "annotations");
            SceneViewModel viewModel = Enumerable.First <AnnotationSceneNode>(annotations).ViewModel;

            if (Enumerable.Any <AnnotationSceneNode>(annotations, (Func <AnnotationSceneNode, bool>)(anno => anno.ViewModel != viewModel)))
            {
                throw new ArgumentException("All of the annotations must be from the same document!", "annotations");
            }
            using (SceneEditTransaction editTransaction = viewModel.CreateEditTransaction(StringTable.DeleteAnnotationsInDocumentUndoUnit))
            {
                this.DeleteCore(annotations);
                editTransaction.Commit();
            }
        }
예제 #5
0
        public AnnotationSceneNode Create(IEnumerable <SceneElement> targets, bool forceAnnotationsVisible)
        {
            ExceptionChecks.CheckNullArgument <IEnumerable <SceneElement> >(targets, "targets");
            ExceptionChecks.CheckEmptyListArgument <SceneElement>(targets, "targets");
            if (forceAnnotationsVisible)
            {
                this.ShowAnnotations = true;
            }
            AnnotationSceneNode annotation = this.designerContext.ActiveSceneViewModel.AnnotationEditor.CreateAnnotation(targets);

            if (Enumerable.Any <SceneElement>(annotation.AttachedElements) && this.ShowAnnotations)
            {
                this.MakeVisible(annotation, targets);
            }
            return(annotation);
        }
예제 #6
0
 private FlowDocument GenerateFlowDocument(IEnumerable <AnnotationSceneNode> annotations)
 {
     ExceptionChecks.CheckNullArgument <IEnumerable <AnnotationSceneNode> >(annotations, "annotations");
     ExceptionChecks.CheckEmptyListArgument <AnnotationSceneNode>(annotations, "annotations");
     return(this.GenerateFlowDocument(Enumerable.Select <AnnotationSceneNode, RawAnnotation>(annotations, (Func <AnnotationSceneNode, RawAnnotation>)(annotation => new RawAnnotation(annotation)))));
 }