Ejemplo n.º 1
0
        public static bool Equals(object objA, object objB, bool includeCallback)
        {
            MultiPropertyChangedHandle handleA = objA as MultiPropertyChangedHandle;
            MultiPropertyChangedHandle handleB = objB as MultiPropertyChangedHandle;

            return((objA == null && objB == null) || (handleA != null && handleB != null && handleA.Equals(handleB, includeCallback)));
        }
Ejemplo n.º 2
0
 public MultiPropertyChangedCallbackArgs(MultiPropertyChangedHandle handle, object[] oldValues, object[] newValues, int changeIndex)
 {
     this.Handle      = handle;
     this.OldValues   = oldValues;
     this.NewValues   = newValues;
     this.ChangeIndex = changeIndex;
 }
Ejemplo n.º 3
0
        public bool Equals(object obj, bool includeCallback)
        {
            MultiPropertyChangedHandle other = obj as MultiPropertyChangedHandle;

            return(other != null && (object.ReferenceEquals(this, obj) ||
                                     (this.PropertyChangedHandles.EqualsElementwise(other.PropertyChangedHandles, (x, y) => PropertyChangedHandle.Equals(x, y, false)) &&
                                      (!includeCallback || this.Callback.Equals(other.Callback)))));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Determines whether the specified <see cref="System.Object"/> is equal to this instance.
        /// </summary>
        /// <param name="obj">The <see cref="System.Object"/> to compare with this instance.</param>
        /// <returns>
        ///     <c>true</c> if the specified <see cref="System.Object"/> is equal to this instance; otherwise, <c>false</c>.
        /// </returns>
        public override bool Equals(object obj)
        {
            DumbBinding other = obj as DumbBinding;

            return(other != null &&
                   ((this.SourcePropertyChangedHandle != null &&
                     PropertyChangedHandle.Equals(this.SourcePropertyChangedHandle, other.SourcePropertyChangedHandle, false)) ||
                    (this.SourceMultiPropertyChangedHandle != null &&
                     MultiPropertyChangedHandle.Equals(this.SourceMultiPropertyChangedHandle, other.SourceMultiPropertyChangedHandle, false))) &&
                   object.Equals(this.Target, other.Target));
        }
Ejemplo n.º 5
0
        private DumbBinding(BindingBase bindingToSource, DumbBindingTarget target)
        {
            if (bindingToSource == null)
            {
                throw new ArgumentNullException("bindingToSource");
            }
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            this.BindingToSource           = bindingToSource;
            this.Target                    = target;
            target.PropertyChangedCallback = this.OnTargetPropertyChanged;

            BindingMode? bindingMode = null;
            Binding      bindingToSourceAsBinding;
            MultiBinding bindingToSourceAsMultiBinding;

            if ((bindingToSourceAsBinding = bindingToSource as Binding) != null)
            {
                bindingMode = bindingToSourceAsBinding.Mode;
                this.SourcePropertyChangedHandle = PropertyChangedHandle.GetDistinctInstance(bindingToSourceAsBinding, this.OnSourceValueChanged);
                this.UpdateTarget(this.SourcePropertyChangedHandle.PropertyValue, false);
            }
            else if ((bindingToSourceAsMultiBinding = bindingToSource as MultiBinding) != null)
            {
                bindingMode = bindingToSourceAsMultiBinding.Mode;
                this.SourceMultiPropertyChangedHandle = MultiPropertyChangedHandle.GetDistinctInstance(bindingToSourceAsMultiBinding.Bindings.Cast <Binding>().ToArray(),
                                                                                                       this.OnSourceValuesChanged);
                this.UpdateTarget(this.MultiConvert(this.GetSourceValues()), false);
            }
            else
            {
                throw new NotSupportedException(String.Format("Binding type {0} not supported.", bindingToSource.GetType()));
            }

            if (bindingMode == BindingMode.OneWayToSource)
            {
                this.UpdateSource();
            }
        }
Ejemplo n.º 6
0
 public CallbackProvider(MultiPropertyChangedHandle owner, int index)
 {
     this.Owner = owner;
     this.Index = index;
 }