/// <summary> /// Should be called when any annotation's cargo changes. /// This will fire the CargoChanged event and cause a flush /// if AutoFlush is true. /// </summary> /// <param name="args">the args for the event</param> protected virtual void OnCargoChanged(AnnotationResourceChangedEventArgs args) { AnnotationResourceChangedEventHandler cargoChanged = null; // Ignore null resources added to an annotation if (args.Resource == null) { return; } lock (SyncRoot) { cargoChanged = CargoChanged; } if (AutoFlush) { Flush(); } if (cargoChanged != null) { cargoChanged(this, args); } }
// 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> /// Used as CargoChanged event handler for all annotations /// handed out by the map. /// </summary> /// <param name="sender">annotation that sent the event</param> /// <param name="e">args for the event</param> private void HandleCargoChanged(object sender, AnnotationResourceChangedEventArgs e) { lock (SyncRoot) { _dirty = true; } OnCargoChanged(e); }
// Token: 0x0600637D RID: 25469 RVA: 0x001BFB98 File Offset: 0x001BDD98 private void HandleCargoChanged(object sender, AnnotationResourceChangedEventArgs e) { object syncRoot = base.SyncRoot; lock (syncRoot) { this._dirty = true; } this.OnCargoChanged(e); }
/// <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); } }
/// <summary>Raises the <see cref="E:System.Windows.Annotations.Storage.AnnotationStore.CargoChanged" /> event.</summary> /// <param name="args">The event data.</param> // Token: 0x0600635F RID: 25439 RVA: 0x001BF220 File Offset: 0x001BD420 protected virtual void OnCargoChanged(AnnotationResourceChangedEventArgs args) { AnnotationResourceChangedEventHandler annotationResourceChangedEventHandler = null; if (args.Resource == null) { return; } object syncRoot = this.SyncRoot; lock (syncRoot) { annotationResourceChangedEventHandler = this.CargoChanged; } if (this.AutoFlush) { this.Flush(); } if (annotationResourceChangedEventHandler != null) { annotationResourceChangedEventHandler(this, args); } }
// Token: 0x06007BC3 RID: 31683 RVA: 0x0022C4DB File Offset: 0x0022A6DB private void OnCargoChanged(object sender, AnnotationResourceChangedEventArgs args) { this._currentAnnotations[args.Annotation.Id].Dirty = true; this._cargoChanged(sender, args); }
//------------------------------------------------------ // // Private Methods // //------------------------------------------------------ #region Private Methods /// <summary> /// the event handler for AnchorChanged Annotation event /// internally it calls the store AnnotationModified delegate /// </summary> /// <param name="sender">annotation that changed</param> /// <param name="args">args describing the change</param> private void OnAnchorChanged(object sender, AnnotationResourceChangedEventArgs args) { _currentAnnotations[args.Annotation.Id].Dirty = true; _anchorChanged(sender, args); }