// Token: 0x06007CC9 RID: 31945 RVA: 0x00231834 File Offset: 0x0022FA34 private void OnAnnotationUpdated(object sender, AnnotationResourceChangedEventArgs args) { Invariant.Assert(this._attachedAnnotation != null && this._attachedAnnotation.Annotation == args.Annotation, "_attachedAnnotation is different than the input one"); Invariant.Assert(this._range != null, "The highlight range is null"); TextAnchor textAnchor = this._attachedAnnotation.AttachedAnchor as TextAnchor; Invariant.Assert(textAnchor != null, "wrong anchor type of the saved attached annotation"); ITextContainer textContainer = textAnchor.Start.TextContainer; Invariant.Assert(textContainer != null, "TextAnchor does not belong to a TextContainer"); Color color; Color color2; this.GetColors(args.Annotation, out color, out color2); if (!this._background.Equals(color) || !this._selectedBackground.Equals(color2)) { Invariant.Assert(textContainer.Highlights != null, "textContainer.Highlights is null"); AnnotationHighlightLayer annotationHighlightLayer = textContainer.Highlights.GetLayer(typeof(HighlightComponent)) as AnnotationHighlightLayer; if (annotationHighlightLayer == null) { throw new InvalidDataException(SR.Get("MissingAnnotationHighlightLayer")); } this._background = color; this._selectedBackground = color2; annotationHighlightLayer.ModifiedRange(this); } }
/// <summary> /// Called when the Annotation cargo changes /// </summary> /// <param name="sender">the sender</param> /// <param name="args">event arguments</param> private void OnAnnotationUpdated(object sender, AnnotationResourceChangedEventArgs args) { Invariant.Assert(_attachedAnnotation != null && _attachedAnnotation.Annotation == args.Annotation, "_attachedAnnotation is different than the input one"); Invariant.Assert(_range != null, "The highlight range is null"); //get text container TextAnchor textAnchor = _attachedAnnotation.AttachedAnchor as TextAnchor; Invariant.Assert(textAnchor != null, "wrong anchor type of the saved attached annotation"); //this should be in a fixed or flow textcontainer ITextContainer textContainer = textAnchor.Start.TextContainer; Invariant.Assert(textContainer != null, "TextAnchor does not belong to a TextContainer"); //Get highlight Colors from the cargo and update the highlight layer Color background, activeBackground; GetColors(args.Annotation, out background, out activeBackground); if (!_background.Equals(background) || !_selectedBackground.Equals(activeBackground)) { //modify the highlight Invariant.Assert(textContainer.Highlights != null, "textContainer.Highlights is null"); //get AnnotationHighlightLayer in the textContainer AnnotationHighlightLayer highlightLayer = textContainer.Highlights.GetLayer(typeof(HighlightComponent)) as AnnotationHighlightLayer; if (highlightLayer == null) { throw new InvalidDataException(SR.Get(SRID.MissingAnnotationHighlightLayer)); } //change the colors and invalidate _background = background; _selectedBackground = activeBackground; highlightLayer.ModifiedRange(this); } }