// Token: 0x060062CF RID: 25295 RVA: 0x001BB61C File Offset: 0x001B981C private static Annotation CreateStickyNoteForSelection(AnnotationService service, XmlQualifiedName noteType, string author) { AnnotationHelper.CheckInputs(service); ITextSelection textSelection = AnnotationHelper.GetTextSelection((FrameworkElement)service.Root); Invariant.Assert(textSelection != null, "TextSelection is null"); if (textSelection.IsEmpty) { throw new InvalidOperationException(SR.Get("EmptySelectionNotSupported")); } Annotation annotation = null; EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordAnnotation, EventTrace.Event.CreateStickyNoteBegin); try { annotation = AnnotationHelper.CreateAnnotationForSelection(service, textSelection, noteType, author); Invariant.Assert(annotation != null, "CreateAnnotationForSelection returned null."); service.Store.AddAnnotation(annotation); textSelection.SetCaretToPosition(textSelection.MovingPosition, textSelection.MovingPosition.LogicalDirection, true, true); } finally { EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordAnnotation, EventTrace.Event.CreateStickyNoteEnd); } return(annotation); }
// Token: 0x060062DC RID: 25308 RVA: 0x001BC0CC File Offset: 0x001BA2CC private static Annotation CreateHighlight(AnnotationService service, ITextRange textRange, string author, Color?color) { Invariant.Assert(textRange != null, "textRange is null"); Annotation annotation = AnnotationHelper.CreateAnnotationForSelection(service, textRange, HighlightComponent.TypeName, author); if (color != null) { ColorConverter colorConverter = new ColorConverter(); XmlDocument xmlDocument = new XmlDocument(); XmlElement xmlElement = xmlDocument.CreateElement("Colors", "http://schemas.microsoft.com/windows/annotations/2003/11/base"); xmlElement.SetAttribute("Background", colorConverter.ConvertToInvariantString(color.Value)); AnnotationResource annotationResource = new AnnotationResource("Highlight"); annotationResource.Contents.Add(xmlElement); annotation.Cargos.Add(annotationResource); } return(annotation); }