Exemplo n.º 1
0
		// This function handles the article switching
		private void ButtonClick(object sender, RoutedEventArgs e)
		{
			switch (((Button)sender).Name)
			{
				case "galaxiesButton":
					// Remove the FlowDocumentReader that's in view now and add in the desired one
					dockPanel.Children.Remove(currentFlowDocumentReader);
					dockPanel.Children.Add(galaxiesFlowDocumentReader);
					currentFlowDocumentReader = galaxiesFlowDocumentReader;
					currentAnnotService = galaxiesAnnotService;
					break;

				case "carsButton":
					// Remove the FlowDocumentReader that's in view now and add in the desired one
					dockPanel.Children.Remove(currentFlowDocumentReader);
					dockPanel.Children.Add(carsFlowDocumentReader);
					currentFlowDocumentReader = carsFlowDocumentReader;
					currentAnnotService = carsAnnotService;
					break;

				default:
					// Remove the FlowDocumentReader that's in view now and add in the desired one
					dockPanel.Children.Remove(currentFlowDocumentReader);
					dockPanel.Children.Add(greekFlowDocumentReader);
					currentFlowDocumentReader = greekFlowDocumentReader;
					currentAnnotService = greekAnnotService;
					break;
			}
		}
Exemplo n.º 2
0
        private void window_Loaded(object sender, RoutedEventArgs e)
        {
            doc = new XpsDocument("ch19.xps", FileAccess.ReadWrite);
            docViewer.Document = doc.GetFixedDocumentSequence();

            service = AnnotationService.GetService(docViewer);
            if (service == null)
            {
                Uri         annotationUri  = PackUriHelper.CreatePartUri(new Uri("AnnotationStream", UriKind.Relative));
                Package     package        = PackageStore.GetPackage(doc.Uri);
                PackagePart annotationPart = null;
                if (package.PartExists(annotationUri))
                {
                    annotationPart = package.GetPart(annotationUri);
                }
                else
                {
                    annotationPart = package.CreatePart(annotationUri, "Annotations/Stream");
                }

                // Load annotations from the package.
                AnnotationStore store = new XmlStreamStore(annotationPart.GetStream());
                service = new AnnotationService(docViewer);
                service.Enable(store);
            }
        }
Exemplo n.º 3
0
        //This method is called when the 'Add Highlight' context menu is
        //clicked by the user on either of the two document viewer controls.
        private void DocumentViewer_AddHighlight(object sender,
                                                 RoutedEventArgs e)
        {
            //Work out which document viewer we are dealing with
            //and get the appropriate store.
            string tag = ((MenuItem)sender).Tag.ToString();

            AnnotationService annotationService =
                tag == "fixed"
                ? fixedAnnotationService
                : flowAnnotationService;

            //Get the current user's name as the author
            string userName = System.Environment.UserName;

            try
            {
                //Creates a yellow highlight
                AnnotationHelper.CreateHighlightForSelection(
                    annotationService, userName, Brushes.Yellow);
            }
            catch (InvalidOperationException)
            {
                MessageBox.Show("Please select some text to highlight.");
            }
        }
Exemplo n.º 4
0
        protected override void Arrange()
        {
            base.Arrange();

            UIServiceMock = new Mock <IUIServiceWpf>(MockBehavior.Strict);

            Container = new UnityContainer();

            Container.RegisterType <AssemblyLocator, BinPathProbingAssemblyLocator>(new ContainerControlledLifetimeManager());
            Container.RegisterType <ConfigurationSectionLocator, AssemblyAttributeSectionLocator>(new ContainerControlledLifetimeManager());
            Container.RegisterType <AnnotationService>(new ContainerControlledLifetimeManager());
            Container.RegisterType <ElementLookup>(new ContainerControlledLifetimeManager());
            Container.RegisterType <DiscoverDerivedConfigurationTypesService>(new ContainerControlledLifetimeManager());
            Container.RegisterType <ConfigurationSourceModel>(new ContainerControlledLifetimeManager());
            Container.RegisterType <ConfigurationSourceDependency>(new ContainerControlledLifetimeManager());
            Container.RegisterType <AnnotationService>(new ContainerControlledLifetimeManager());
            Container.RegisterType(typeof(IResolver <>), typeof(GenericResolver <>));
            Container.RegisterInstance <IServiceProvider>(new ContainerProvider(Container));
            Container.RegisterInstance <IUIServiceWpf>(UIServiceMock.Object);
            Container.RegisterType <SaveOperation>(new ContainerControlledLifetimeManager());

            Container.RegisterType <IApplicationModel, ApplicationViewModel>(new ContainerControlledLifetimeManager());

            AnnotationService annotationService = Container.Resolve <AnnotationService>();

            annotationService.DiscoverSubstituteTypesFromAssemblies();
        }
Exemplo n.º 5
0
        /// <summary>
        ///     This method is called after PreProcessNode and after all the children
        ///     in the subtree have been processed (or skipped if PreProcessNode returns
        ///     true for calledProcessAnnotations).
        ///     If no calls to ProcessAnnotations were made for any portion of the subtree below
        ///     this node, then annotations for this node will be loaded
        /// </summary>
        /// <param name="node">the node to process</param>
        /// <param name="childrenCalledProcessAnnotations">indicates whether calledProcessAnnotations
        /// was returned as true by any node underneath this node</param>
        /// <param name="calledProcessAnnotations">indicates whether ProcessAnnotations was called
        /// by this method</param>
        /// <returns>
        ///     a list of AttachedAnnotations loaded during the processing of
        ///     the node; can be null if no annotations were loaded
        /// </returns>
        public override IList <IAttachedAnnotation> PostProcessNode(DependencyObject node, bool childrenCalledProcessAnnotations, out bool calledProcessAnnotations)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            // We get the local value so we can distinguish between the property
            // being set or not.  We don't want to rely on null or String.Empty because
            // those might have been the values set.
            object dataId       = node.ReadLocalValue(DataIdProcessor.DataIdProperty);
            bool   fetchAsBatch = (bool)node.GetValue(FetchAnnotationsAsBatchProperty);

            // If no children were processed, we try and process this node
            if (!fetchAsBatch && !childrenCalledProcessAnnotations && dataId != DependencyProperty.UnsetValue)
            {
                FrameworkElement nodeParent = null;
                FrameworkElement feNode     = node as FrameworkElement;
                if (feNode != null)
                {
                    nodeParent = feNode.Parent as FrameworkElement;
                }
                AnnotationService service = AnnotationService.GetService(node);
                if (service != null &&
                    (service.Root == node ||
                     (nodeParent != null && service.Root == nodeParent.TemplatedParent)))
                {
                    calledProcessAnnotations = true;
                    return(Manager.ProcessAnnotations(node));
                }
            }

            calledProcessAnnotations = false;
            return(null);
        }
        // Token: 0x06007BEF RID: 31727 RVA: 0x0022D4F0 File Offset: 0x0022B6F0
        public override IList <IAttachedAnnotation> PostProcessNode(DependencyObject node, bool childrenCalledProcessAnnotations, out bool calledProcessAnnotations)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }
            object obj = node.ReadLocalValue(DataIdProcessor.DataIdProperty);

            if (!(bool)node.GetValue(DataIdProcessor.FetchAnnotationsAsBatchProperty) && !childrenCalledProcessAnnotations && obj != DependencyProperty.UnsetValue)
            {
                FrameworkElement frameworkElement  = null;
                FrameworkElement frameworkElement2 = node as FrameworkElement;
                if (frameworkElement2 != null)
                {
                    frameworkElement = (frameworkElement2.Parent as FrameworkElement);
                }
                AnnotationService service = AnnotationService.GetService(node);
                if (service != null && (service.Root == node || (frameworkElement != null && service.Root == frameworkElement.TemplatedParent)))
                {
                    calledProcessAnnotations = true;
                    return(base.Manager.ProcessAnnotations(node));
                }
            }
            calledProcessAnnotations = false;
            return(null);
        }
Exemplo n.º 7
0
        private void StartFixedDocumentAnnotations()
        {
            //If there is no AnnotationService yet, create one.
            if (fixedAnnotationService == null)
            {
                fixedAnnotationService
                    = new AnnotationService(dvDocumentViewer);
            }

            //If the AnnotationService is currently enabled, disable it
            //as you'll need to re-enable it with a new store object.
            if (fixedAnnotationService.IsEnabled)
            {
                fixedAnnotationService.Disable();
            }

            //Open a memory stream for storing annotations.
            fixedAnnotationBuffer = new MemoryStream();

            //Create a new AnnotationStore using the above stream.
            fixedAnntationStore = new XmlStreamStore(fixedAnnotationBuffer);

            //Enable the AnnotationService using the new store object.
            fixedAnnotationService.Enable(fixedAnntationStore);
        }
Exemplo n.º 8
0
        }// end:GetPackage()

        //<SnippetDocViewXmlStartStopAnnotat>
        //<SnippetDocViewXmlStartAnnotations>
        // ------------------------ StartAnnotations --------------------------
        /// <summary>
        ///   Enables annotations and displays all that are viewable.</summary>
        private void StartAnnotations()
        {
            // If there is no AnnotationService yet, create one.
            if (_annotService == null)
            {
                // docViewer is a document viewing control named in Window1.xaml.
                _annotService = new AnnotationService(docViewer);
            }

            // If the AnnotationService is currently enabled, disable it.
            if (_annotService.IsEnabled == true)
            {
                _annotService.Disable();
            }

            // Open a stream to the file for storing annotations.
            _annotStream = new FileStream(
                _annotStorePath, FileMode.OpenOrCreate, FileAccess.ReadWrite);

            // Create an AnnotationStore using the file stream.
            _annotStore = new XmlStreamStore(_annotStream);

            // Enable the AnnotationService using the new store.
            _annotService.Enable(_annotStore);
        }// end:StartAnnotations()
Exemplo n.º 9
0
        // Token: 0x06007C8C RID: 31884 RVA: 0x0023063C File Offset: 0x0022E83C
        private IAnnotationComponent FindComponent(IAttachedAnnotation attachedAnnotation)
        {
            UIElement d = attachedAnnotation.Parent as UIElement;
            AnnotationComponentChooser chooser = AnnotationService.GetChooser(d);

            return(chooser.ChooseAnnotationComponent(attachedAnnotation));
        }
Exemplo n.º 10
0
 internal static void ClearMatches(this AnnotationService service)
 {
     foreach (var annotation in service.Store.GetAnnotations())
     {
         service.Store.DeleteAnnotation(annotation.Id);
     }
 }
Exemplo n.º 11
0
            public override MKAnnotationView GetViewForAnnotation(MKMapView mapView, IMKAnnotation annotation)
            {
                MKAnnotationView annotationView = null;

                if (annotation is MKUserLocation)
                {
                    return(null);
                }

                if (annotation is FoodMarkerAnnotation)
                {
                    AnnotationService service = new AnnotationService();
                    annotationView = service.GetAnnotationView(mapView, annotation);
                }
                else if (annotation is MKClusterAnnotation)
                {
                    AnnotationService service = new AnnotationService();
                    annotationView = service.GetClusterAnnotationView(mapView, annotation);
                }
                else if (annotation != null)
                {
                    var unwrappedAnnotation = MKAnnotationWrapperExtensions.UnwrapClusterAnnotation(annotation);

                    return(GetViewForAnnotation(mapView, unwrappedAnnotation));
                }

                return(annotationView);
            }
Exemplo n.º 12
0
        // ------------------------- OnStyleSelected --------------------------
        /// <summary>
        ///     Replaces the default StickyNote style when a new
        ///     style is selected from the drop down combo box.
        /// </summary>
        protected void OnStyleSelected(object sender, SelectionChangedEventArgs e)
        {
            // Extract the selected style.
            var source        = (ComboBox)e.Source;
            var selectedStyle = (StyleMetaData)source.SelectedItem;
            var newStyle      = new Style(typeof(StickyNoteControl))
            {
                BasedOn = selectedStyle.Value
            };

            // Replace the default StickyNote style with the one that was just selected.
            var defaultKey = typeof(StickyNoteControl);

            if (Viewer.Resources.Contains(defaultKey))
            {
                Viewer.Resources.Remove(defaultKey);
            }
            Viewer.Resources.Add(defaultKey, newStyle);

            // Re-load annotations so that they pickup new style.
            var service = AnnotationService.GetService(Viewer);

            service.Disable();
            service.Enable(service.Store);
        }
        // Token: 0x06007854 RID: 30804 RVA: 0x002243FC File Offset: 0x002225FC
        public static void UpdateAnnotation(XmlToken token, StickyNoteControl snc, SNCAnnotation sncAnnotation)
        {
            AnnotationService annotationService = null;
            bool autoFlush = false;

            try
            {
                annotationService = AnnotationService.GetService(((IAnnotationComponent)snc).AnnotatedElement);
                if (annotationService != null && annotationService.Store != null)
                {
                    autoFlush = annotationService.Store.AutoFlush;
                    annotationService.Store.AutoFlush = false;
                }
                if ((token & XmlToken.Ink) != (XmlToken)0 && snc.Content.Type == StickyNoteType.Ink)
                {
                    sncAnnotation.UpdateContent(snc, true, XmlToken.Ink);
                }
                if ((token & XmlToken.Text) != (XmlToken)0 && snc.Content.Type == StickyNoteType.Text)
                {
                    sncAnnotation.UpdateContent(snc, true, XmlToken.Text);
                }
                if ((token & (XmlToken.Left | XmlToken.Top | XmlToken.XOffset | XmlToken.YOffset | XmlToken.Width | XmlToken.Height | XmlToken.IsExpanded | XmlToken.Author | XmlToken.ZOrder)) != (XmlToken)0)
                {
                    SNCAnnotation.UpdateMetaData(token, snc, sncAnnotation);
                }
            }
            finally
            {
                if (annotationService != null && annotationService.Store != null)
                {
                    annotationService.Store.AutoFlush = autoFlush;
                }
            }
        }
Exemplo n.º 14
0
 internal void TearDown()
 {
     this.sceneView.ViewModel.AnimationEditor.RecordModeChanged -= new EventHandler(this.AnimationEditor_RecordModeChanged);
     this.sceneView.ViewModel.LateSceneUpdatePhase -= new SceneUpdatePhaseEventHandler(this.ViewModel_LateSceneUpdate);
     this.artboard.ZoomChanged   -= new EventHandler(this.Artboard_ZoomChanged);
     this.artboard.CenterChanged -= new EventHandler(this.Artboard_CenterChanged);
     this.artboard.SnapToGridRenderer.Detach();
     if (this.sceneView.ViewModel.DesignerContext != null)
     {
         AnnotationService annotationService = this.sceneView.DesignerContext.AnnotationService;
         if (annotationService != null)
         {
             annotationService.ShowAnnotationsChanged    -= new EventHandler(this.AnnotationService_ShowAnnotationsChanged);
             annotationService.AnnotationsEnabledChanged -= new EventHandler(this.AnnotationService_AnnotationsEnabledChanged);
         }
     }
     if (this.sceneView.ViewModel.DesignerContext.SnappingEngine != null)
     {
         this.sceneView.ViewModel.DesignerContext.ArtboardOptionsChanged -= new EventHandler(this.OnArtboardOptionsChanged);
     }
     if (this.sceneView.ViewModel.DesignerContext.WindowService != null)
     {
         this.sceneView.ViewModel.DesignerContext.WindowService.ThemeChanged -= new EventHandler(this.WindowManager_ThemeChanged);
     }
     this.LayoutUpdated -= new EventHandler(this.SceneScrollViewer_LayoutUpdated);
     this.horizontalScrollBar.ValueChanged -= new RoutedPropertyChangedEventHandler <double>(this.HorizontalScrollBar_ValueChanged);
     this.verticalScrollBar.ValueChanged   -= new RoutedPropertyChangedEventHandler <double>(this.VerticalScrollBar_ValueChanged);
     this.horizontalScrollBar = (ExtendedScrollBar)null;
     this.verticalScrollBar   = (ExtendedScrollBar)null;
     this.artboard.TearDown();
     this.artboard  = (Artboard)null;
     this.Child     = (UIElement)null;
     this.sceneView = (SceneView)null;
 }
Exemplo n.º 15
0
        //<SnippetStartStopAnnotations>
        //<SnippetStartAnnotations>
        // ------------------------- StartAnnotations -------------------------
        /// <summary>
        ///   Enables annotations processing and
        ///   displays viewable annotations.</summary>
        /// <remarks>
        ///     SetSource must be called first before
        ///     calling StartAnnotations().</remarks>
        public void StartAnnotations()
        {
            if (_docViewer == null)
            {
                throw new InvalidOperationException(
                          "Required DocumentViewer control has not been specified.");
            }

            if ((_packageUri == null) || (_rootUri == null))
            {
                throw new InvalidOperationException(
                          "Required SetSource() has not been called.");
            }

            // If there is no AnnotationService yet, create one.
            if (_annotService == null)
            {
                // Get the annotations data stream from the XPS container.
                _annotStream = GetAnnotationPart(_rootUri).GetStream();

                // Create the AnnotationService.
                _annotService = new AnnotationService(_docViewer);

                // Enable the service with the annotation data stream.
                _annotService.Enable(new XmlStreamStore(_annotStream));
            }

            // Else if the annotationService exists but is not enabled, enable it.
            else if (!_annotService.IsEnabled)
            {
                _annotService.Enable(_annotService.Store);
            }
        }// end:StartAnnotations()
Exemplo n.º 16
0
        private void StartFixedDocumentAnnotations()
        {
            //If there is no AnnotationService yet, create one.
            if (fixedAnnotationService == null)
            {
                fixedAnnotationService = new AnnotationService(dvViewer);
            }

            //If the AnnotationService is currently enabled, disable it
            //as you'll need to re-enable it with a new store object.
            if (fixedAnnotationService.IsEnabled)
            {
                fixedAnnotationService.Disable();
            }

            //Open a stream to the file for storing annotations.
            fixedAnnotationBuffer =
                GetAnnotationPart(GetFixedDocumentSequenceUri()).GetStream();

            //Create a new AnnotationStore using the file stream.
            fixedAnntationStore = new XmlStreamStore(fixedAnnotationBuffer);

            //Enable the AnnotationService using the new store object.
            fixedAnnotationService.Enable(fixedAnntationStore);
        }
Exemplo n.º 17
0
        protected void window_Loaded(object sender, RoutedEventArgs e)
        {
            WindowsIdentity identity = System.Security.Principal.WindowsIdentity.GetCurrent();

            this.Resources["AuthorName"] = identity.Name;

            service = AnnotationService.GetService(docReader);

            if (service == null)
            {
                // Create a stream for the annotations to be stored in.
                //AnnotationStream =
                // new FileStream("annotations.xml", FileMode.OpenOrCreate);
                annotationStream = new MemoryStream();

                // Create the on the document container.
                service = new AnnotationService(docReader);

                // Create the AnnotationStore using the stream.
                AnnotationStore store = new XmlStreamStore(annotationStream);

                // Enable annotations.
                service.Enable(store);
            }
        }
Exemplo n.º 18
0
 public static void Main(string[] args)
 {
     Console.WriteLine("Assembly Annotations Analizer by Alexander Lozhkin");
     try
     {
         if (args.Length != 1)
         {
             PrintUsage();
             Environment.ExitCode = WRONG_COMMAND_LINE_ARGUMENTS;
         }
         else
         {
             var filename = args.First();
             //composition root
             var service  = new AnnotationService(new AnnotattionsContext());
             var provider = new DefaultAnnotationInfoProvider();
             //method injection
             App(filename, service, provider);
         }
     }
     catch (Exception ex)
     {
         Console.ForegroundColor = ConsoleColor.DarkRed;
         Console.WriteLine("Error ocured: {0}", ex);
         Environment.ExitCode = OTHER_ERROR_CODE;
         Console.ResetColor();
     }
     Console.WriteLine("Press any key to exit");
     Console.ReadKey();
 }
Exemplo n.º 19
0
 // Token: 0x06007C88 RID: 31880 RVA: 0x002304D9 File Offset: 0x0022E6D9
 internal AnnotationComponentManager(AnnotationService service)
 {
     if (service != null)
     {
         service.AttachedAnnotationChanged += this.AttachedAnnotationUpdateEventHandler;
     }
 }
Exemplo n.º 20
0
 public EzTag(ILogger <EzTag> logger, IConsole console, Git git, TagService tagService, AnnotationService annotationService)
 {
     _logger            = logger;
     _console           = console;
     _git               = git;
     _tagService        = tagService;
     _annotationService = annotationService;
 }
 public MyAnnotationStore(FlowDocumentReader myDocumentReader)
 {
     // Create the AnnotationService object that works
     // with our FlowDocumentReader.
     _anoService = new AnnotationService(myDocumentReader);
     // Create a MemoryStream which will hold the annotations.
     _storeMemory = new MemoryStream();
 }
Exemplo n.º 22
0
        private void EnableAnnotations()
        {
            var anoService = new AnnotationService(MyDocumentReader);
            var anoStream  = new MemoryStream();
            var store      = new XmlStreamStore(anoStream);

            anoService.Enable(store);
        }
        private void EnableAnnotations()
        {
            AnnotationService anoService = new AnnotationService(myDocumentReader);
            MemoryStream      anoStream  = new MemoryStream();
            AnnotationStore   store      = new XmlStreamStore(anoStream);

            anoService.Enable(store);
        }
Exemplo n.º 24
0
        protected override void Arrange()
        {
            Mock <AssemblyLocator> assemblyLocator = new Mock <AssemblyLocator>();

            assemblyLocator.Setup(x => x.Assemblies).Returns(new Assembly[] { typeof(when_type_is_found_with_metadata_type_attribute).Assembly });

            annotationService = new AnnotationService(assemblyLocator.Object);
        }
Exemplo n.º 25
0
        private void NewFoodMarkerOnLoad(object sender, EventArgs e)
        {
            FoodMarker           newMarker         = (FoodMarker)sender;
            AnnotationService    annotationService = new AnnotationService();
            FoodMarkerAnnotation annotation        = annotationService.LoadAnnotations(newMarker);

            _foodMarkerAnnotationDict.Add(newMarker.FoodMarkerId, annotation);
            MapView.AddAnnotation(annotation);
        }
Exemplo n.º 26
0
        // Token: 0x06007C04 RID: 31748 RVA: 0x0022DB84 File Offset: 0x0022BD84
        public IList <IAttachedAnnotation> ProcessAnnotations(DependencyObject node)
        {
            base.VerifyAccess();
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }
            IList <IAttachedAnnotation> list  = new List <IAttachedAnnotation>();
            IList <ContentLocatorBase>  list2 = this.GenerateLocators(node);

            if (list2.Count > 0)
            {
                AnnotationStore annotationStore;
                if (this._internalStore != null)
                {
                    annotationStore = this._internalStore;
                }
                else
                {
                    AnnotationService service = AnnotationService.GetService(node);
                    if (service == null || !service.IsEnabled)
                    {
                        throw new InvalidOperationException(SR.Get("AnnotationServiceNotEnabled"));
                    }
                    annotationStore = service.Store;
                }
                ContentLocator[] array = new ContentLocator[list2.Count];
                list2.CopyTo(array, 0);
                IList <Annotation> annotations = annotationStore.GetAnnotations(array[0]);
                foreach (ContentLocatorBase contentLocatorBase in list2)
                {
                    ContentLocator contentLocator = (ContentLocator)contentLocatorBase;
                    if (contentLocator.Parts[contentLocator.Parts.Count - 1].NameValuePairs.ContainsKey("IncludeOverlaps"))
                    {
                        contentLocator.Parts.RemoveAt(contentLocator.Parts.Count - 1);
                    }
                }
                foreach (Annotation annotation in annotations)
                {
                    foreach (AnnotationResource annotationResource in annotation.Anchors)
                    {
                        foreach (ContentLocatorBase locator in annotationResource.ContentLocators)
                        {
                            AttachmentLevel attachmentLevel;
                            object          attachedAnchor = this.FindAttachedAnchor(node, array, locator, out attachmentLevel);
                            if (attachmentLevel != AttachmentLevel.Unresolved)
                            {
                                list.Add(new AttachedAnnotation(this, annotation, annotationResource, attachedAnchor, attachmentLevel));
                                break;
                            }
                        }
                    }
                }
            }
            return(list);
        }
Exemplo n.º 27
0
 /// <summary>
 /// Return an annotation component manager.  If an annotation service is passed in, manager will
 /// receive notification from the service.  Otherwise it will expect to be called directly.
 /// </summary>
 /// <param name="service">optional, annotation service the annotation component manager will register on</param>
 internal AnnotationComponentManager(AnnotationService service)
     : base()
 {
     // Only register if a service was passed in. If no service was passed in, we will not receive events.
     // This means a client will be calling us directly.
     if (service != null)
     {
         service.AttachedAnnotationChanged += new AttachedAnnotationChangedEventHandler(AttachedAnnotationUpdateEventHandler);
     }
 }
Exemplo n.º 28
0
        protected void OnClosed(object sender, EventArgs e)
        {
            // Выключить и сохранить комментарии
            AnnotationService service = AnnotationService.GetService(reader);

            if (service != null && service.IsEnabled)
            {
                service.Disable();
                stream.Close();
            }
        }
Exemplo n.º 29
0
        internal static void HighlightText(this FlowDocumentScrollViewer viewer, AnnotationService service, int offset, int length)
        {
            var brush    = new SolidColorBrush(Color.FromArgb(127, (byte)random.Next(200), (byte)random.Next(200), (byte)random.Next(200)));
            var startPos = viewer.Document.ContentStart.GetOffsetTextPointer(offset);
            var endPos   = startPos.GetOffsetTextPointer(length);

            viewer.Selection.Select(startPos, endPos);

            AnnotationHelper.CreateHighlightForSelection(service, String.Empty, brush);
            //textRange.ApplyPropertyValue(TextElement.FontWeightProperty, FontWeights.Bold);
        }
 // Token: 0x06007BEC RID: 31724 RVA: 0x0022D46C File Offset: 0x0022B66C
 private AnnotationStore GetStore()
 {
     if (this.Parent != null)
     {
         AnnotationService service = AnnotationService.GetService(this.Parent);
         if (service != null)
         {
             return(service.Store);
         }
     }
     return(null);
 }
Exemplo n.º 31
0
        public static SortedList<string, List<Structure>> LabelToStructuresMap(AnnotationService.AnnotateStructureTypesClient client)
        {
            long typeID =1;
            AnnotationService.Structure[] structures = client.GetStructuresForType(typeID);

            return LabelToStructuresMap(structures);
        }