Exemplo n.º 1
1
 /// <summary>
 ///     Called when source changed.
 /// </summary>
 /// <param name="args">
 ///     The args.
 /// </param>
 private void OnSourceChanged(SourceChangedEventArgs args)
 {
     if (this.SourceChanged != null)
     {
         this.SourceChanged(this, args);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 ///     Called when source changed.
 /// </summary>
 /// <param name="args">
 ///     The args.
 /// </param>
 private void OnSourceChanged(SourceChangedEventArgs args)
 {
     if (this.SourceChanged != null)
     {
         this.SourceChanged(this, args);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        ///     Update the instance.
        /// </summary>
        /// <param name="forceEvent">
        ///     Indicates whether force to raise the SourceChangedEvent.
        /// </param>
        public void Update(bool forceEvent = false)
        {
            if (this.propertyObservation == null)
            {
                return;
            }

            var tail = this.Tail;

            if (tail != null)
            {
                this.Source = tail.Source;
            }

            var value    = this.SourceMode == SourceMode.Property ? this.Value : this.Source;
            var oldValue = this.oldValueReference != null ? this.oldValueReference.Target : null;

            if (!forceEvent && object.Equals(oldValue, value))
            {
                return;
            }

            var changedEventArgs = new SourceChangedEventArgs(this.SourceMode, oldValue, value);

            this.OnSourceChanged(changedEventArgs);

            oldValueReference = new WeakReference(value);
        }
Exemplo n.º 4
0
        /// <summary>
        ///     Handles the <see cref="E:SourceChanged" /> event.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="SourceChangedEventArgs"/> instance containing the event data.</param>
        private void OnSourceChanged(object sender, SourceChangedEventArgs e)
        {
            if (e.OldSource == e.NewSource)
            {
                return;
            }

            this.DetachEvent();
            this.AttachEvent(
                this.Data,
                this.EventName,
                this.HandlerName,
                this.eventFilter);
        }
Exemplo n.º 5
0
        /// <summary>
        ///     Update the instance.
        /// </summary>
        /// <param name="forceEvent">
        ///     Indicates whether force to raise the SourceChangedEvent.
        /// </param>
        public void Update(bool forceEvent = false)
        {
            if (this.propertyObservation == null)
            {
                return;
            }

            var tail = this.Tail;
            if (tail != null)
            {
                this.Source = tail.Source;
            }

            var value = this.SourceMode == SourceMode.Property ? this.Value : this.Source;
            var oldValue = this.oldValueReference != null ? this.oldValueReference.Target : null;
            if (!forceEvent && object.Equals(oldValue, value))
            {
                return;
            }

            var changedEventArgs = new SourceChangedEventArgs(this.SourceMode, oldValue, value);
            this.OnSourceChanged(changedEventArgs);

            oldValueReference = new WeakReference(value);
        }
Exemplo n.º 6
0
        /// <summary>
        ///     Handles the <see cref="E:SourceChanged" /> event.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="SourceChangedEventArgs"/> instance containing the event data.</param>
        private void OnSourceChanged(object sender, SourceChangedEventArgs e)
        {
            if (e.OldSource == e.NewSource)
            {
                return;
            }

            this.DetachEvent();
            this.AttachEvent(
                this.Data,
                this.EventName,
                this.HandlerName,
                this.eventFilter);
        }