Beispiel #1
0
        /// <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);
            }
        }
        //------------------------------------------------------
        //
        //  Constructors
        //
        //------------------------------------------------------

        #region Constructors

        /// <summary>
        /// Constructor for StoreAnnotationsMap 
        /// It takes instances of the AnnotationAuthorChangedEventHandler, AnnotationResourceChangedEventHandler, AnnotationResourceChangedEventHandler delegates
        /// </summary>
        /// <param name="authorChanged">delegate used to register for AuthorChanged events on all annotations</param>
        /// <param name="anchorChanged">delegate used to register for AnchorChanged events on all annotations</param>
        /// <param name="cargoChanged">delegate used to register for CargoChanged events on all annotations</param>
        internal StoreAnnotationsMap(AnnotationAuthorChangedEventHandler authorChanged, AnnotationResourceChangedEventHandler anchorChanged, AnnotationResourceChangedEventHandler cargoChanged)
        {
            Debug.Assert(authorChanged != null && anchorChanged != null && cargoChanged != null,
                         "Author and Anchor and Cargo must not be null");

            _authorChanged = authorChanged;
            _anchorChanged = anchorChanged;
            _cargoChanged = cargoChanged;
        }
Beispiel #3
0
        //------------------------------------------------------
        //
        //  Constructors
        //
        //------------------------------------------------------

        #region Constructors

        /// <summary>
        /// Constructor for StoreAnnotationsMap
        /// It takes instances of the AnnotationAuthorChangedEventHandler, AnnotationResourceChangedEventHandler, AnnotationResourceChangedEventHandler delegates
        /// </summary>
        /// <param name="authorChanged">delegate used to register for AuthorChanged events on all annotations</param>
        /// <param name="anchorChanged">delegate used to register for AnchorChanged events on all annotations</param>
        /// <param name="cargoChanged">delegate used to register for CargoChanged events on all annotations</param>
        internal StoreAnnotationsMap(AnnotationAuthorChangedEventHandler authorChanged, AnnotationResourceChangedEventHandler anchorChanged, AnnotationResourceChangedEventHandler cargoChanged)
        {
            Debug.Assert(authorChanged != null && anchorChanged != null && cargoChanged != null,
                         "Author and Anchor and Cargo must not be null");

            _authorChanged = authorChanged;
            _anchorChanged = anchorChanged;
            _cargoChanged  = cargoChanged;
        }
        /// <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);
            }
        }
Beispiel #5
0
 // Token: 0x06007BBA RID: 31674 RVA: 0x0022C0E2 File Offset: 0x0022A2E2
 internal StoreAnnotationsMap(AnnotationAuthorChangedEventHandler authorChanged, AnnotationResourceChangedEventHandler anchorChanged, AnnotationResourceChangedEventHandler cargoChanged)
 {
     this._authorChanged = authorChanged;
     this._anchorChanged = anchorChanged;
     this._cargoChanged  = cargoChanged;
 }
 // Token: 0x0600627C RID: 25212 RVA: 0x001BA4A0 File Offset: 0x001B86A0
 private void FireResourceEvent(AnnotationResource resource, AnnotationAction action, AnnotationResourceChangedEventHandler handlers)
 {
     Invariant.Assert(action >= AnnotationAction.Added && action <= AnnotationAction.Modified, "Unknown AnnotationAction");
     this._modified = DateTime.Now;
     if (handlers != null)
     {
         handlers(this, new AnnotationResourceChangedEventArgs(this, action, resource));
     }
 }
        /// <summary>
        ///     Fires a ResourceChanged event for the given resource and action.
        /// </summary>
        /// <param name="resource">the resource to notify about</param>
        /// <param name="action">the action that took place for that resource</param>
        /// <param name="handlers">the handlers to notify</param>
        private void FireResourceEvent(AnnotationResource resource, AnnotationAction action, AnnotationResourceChangedEventHandler handlers)
        {
            // resource can be null - we allow that because it could be added or removed from the annotation.
            Invariant.Assert(action >= AnnotationAction.Added && action <= AnnotationAction.Modified, "Unknown AnnotationAction");

            // Always update the modification time before firing change events
            _modified = DateTime.Now;

            if (handlers != null)
            {
                handlers(this, new AnnotationResourceChangedEventArgs(this, action, resource));
            }
        }
Beispiel #8
0
        /// <summary>
        ///     Fires a ResourceChanged event for the given resource and action.
        /// </summary>
        /// <param name="resource">the resource to notify about</param>
        /// <param name="action">the action that took place for that resource</param>
        /// <param name="handlers">the handlers to notify</param>
        private void FireResourceEvent(AnnotationResource resource, AnnotationAction action, AnnotationResourceChangedEventHandler handlers)
        {
            // resource can be null - we allow that because it could be added or removed from the annotation.
            Invariant.Assert(action >= AnnotationAction.Added && action <= AnnotationAction.Modified, "Unknown AnnotationAction");

            // Always update the modification time before firing change events
            _modified = DateTime.Now;

            if (handlers != null)
            {
                handlers(this, new AnnotationResourceChangedEventArgs(this, action, resource));
            }
        }