public void SetsValuesCorrectlyForNullPropertyName()
            {
                var iniEntry = new IniEntry();
                var nullEventArgs = new AdvancedPropertyChangedEventArgs(iniEntry, (string) null);

                Assert.AreEqual(null, nullEventArgs.PropertyName);
            }
            public void SetsValuesCorrectlyForEmptyPropertyName()
            {
                var iniEntry = new IniEntry();
                var nullEventArgs = new AdvancedPropertyChangedEventArgs(iniEntry, string.Empty);

                Assert.AreEqual(string.Empty, nullEventArgs.PropertyName);
            }
Exemple #3
0
        /// <summary>
        /// Raises the <see cref="PropertyChanged"/> event.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="propertyName">Name of the property.</param>
        /// <param name="oldValue">The old value.</param>
        /// <param name="newValue">The new value.</param>
        protected internal void RaisePropertyChanged(object sender, string propertyName, object oldValue, object newValue)
        {
            // This is 1 of the 3 places where the AdvancedPropertyChangedEventArgs are created
            var eventArgs = new AdvancedPropertyChangedEventArgs(sender, propertyName, oldValue, newValue);

            RaisePropertyChanged(sender, eventArgs);
        }
Exemple #4
0
        /// <summary>
        /// Raises the <see cref="PropertyChanged"/> event.
        /// <para />
        /// This is the one and only method that actually raises the <see cref="PropertyChanged"/> event. All other
        /// methods are (and should be) just overloads that eventually call this method.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.ComponentModel.PropertyChangedEventArgs"/> instance containing the event data.</param>
        protected virtual void RaisePropertyChanged(object sender, AdvancedPropertyChangedEventArgs e)
        {
            PropertyChanged.SafeInvoke(sender, e);

            if (ReferenceEquals(this, sender))
            {
                OnPropertyChanged(e);
            }
        }
            public void SetsValuesCorrectlyWithTwoArguments()
            {
                var iniEntry = new IniEntry();
                var iniFile = new IniFile();

                var originalEventArgs = new AdvancedPropertyChangedEventArgs(iniEntry, "PropertyName");

                var eventArgs = new AdvancedPropertyChangedEventArgs(iniFile, originalEventArgs);

                Assert.AreEqual(iniEntry, eventArgs.OriginalSender);
                Assert.AreEqual(iniFile, eventArgs.LatestSender);
                Assert.AreEqual("PropertyName", eventArgs.PropertyName);
            }
            public void SetsValuesCorrectlyWithTheeArgumentsExceptOldValue()
            {
                IniEntry iniEntry = new IniEntry();

                var eventArgs = new AdvancedPropertyChangedEventArgs(iniEntry, "PropertyName", (object) "new value");

                Assert.AreEqual(iniEntry, eventArgs.OriginalSender);
                Assert.AreEqual(iniEntry, eventArgs.LatestSender);
                Assert.AreEqual("PropertyName", eventArgs.PropertyName);
                Assert.AreEqual(null, eventArgs.OldValue);
                Assert.AreEqual("new value", eventArgs.NewValue);
                Assert.AreEqual(false, eventArgs.IsOldValueMeaningful);
                Assert.AreEqual(true, eventArgs.IsNewValueMeaningful);
            }
            public void SetsValuesCorrectlyWithAllARguments()
            {
                var iniEntry = new IniEntry();

                var eventArgs = new AdvancedPropertyChangedEventArgs(iniEntry, "PropertyName", (object) "old value", "new value");

                Assert.AreEqual(iniEntry, eventArgs.OriginalSender);
                Assert.AreEqual(iniEntry, eventArgs.LatestSender);
                Assert.AreEqual("PropertyName", eventArgs.PropertyName);
                Assert.AreEqual("old value", eventArgs.OldValue);
                Assert.AreEqual("new value", eventArgs.NewValue);
                Assert.AreEqual(true, eventArgs.IsOldValueMeaningful);
                Assert.AreEqual(true, eventArgs.IsNewValueMeaningful);
            }
Exemple #8
0
        private void OnPinMaskedChanged(Catel.Data.AdvancedPropertyChangedEventArgs args)
        {
            var oldValue = this.Pin;
            var newValue = this.PinMasked;

            if ((oldValue.Length + 1) == newValue.Length)
            {
                var change = this.RemoveInvalidChars(newValue.Substring(oldValue.Length, 1));
                this.Pin      += change;
                this.PinMasked = new string(Enumerable.Repeat('*', this.Pin.Length).ToArray());
            }
            else if (oldValue.Length > newValue.Length)
            {
                this.Pin       = this.Pin.Substring(0, newValue.Length);
                this.PinMasked = new string(Enumerable.Repeat('*', this.Pin.Length).ToArray());
            }
        }
        private void OnNewPasswordConfirmedMaskedChanged(Catel.Data.AdvancedPropertyChangedEventArgs args)
        {
            var oldValue = args.OldValue as string;
            var newValue = args.NewValue as string;

            if (((oldValue ?? string.Empty).Length + 1) == ((newValue ?? string.Empty).Length))
            {
                var change = (newValue ?? string.Empty).Substring((oldValue ?? string.Empty).Length, 1);
                NewPasswordConfirmed      += change;
                NewPasswordConfirmedMasked = NewPasswordConfirmedMasked.Replace(change, "*");
            }
            else if ((oldValue ?? string.Empty).Length > (newValue ?? string.Empty).Length)
            {
                NewPasswordConfirmed       = NewPasswordConfirmed.Substring(0, (newValue ?? string.Empty).Length);
                NewPasswordConfirmedMasked = NewPasswordConfirmedMasked.Substring(0, (newValue ?? string.Empty).Length);
            }
        }
Exemple #10
0
        /// <summary>
        /// Raises the <see cref="E:PropertyChanged" /> event.
        /// </summary>
        /// <param name="e">The <see cref="AdvancedPropertyChangedEventArgs"/> instance containing the event data.</param>
        protected override void OnPropertyChanged(AdvancedPropertyChangedEventArgs e)
        {
            base.OnPropertyChanged(e);

            var propertyName = e.PropertyName;

            if (!string.IsNullOrWhiteSpace(propertyName))
            {
                if (PropertiesNotCausingValidation.TryGetValue(GetType(), out HashSet <string> ignoredProperties))
                {
                    if (ignoredProperties.Contains(propertyName))
                    {
                        return;
                    }
                }
            }

            _isValidated = false;

            if (AutomaticallyValidateOnPropertyChanged)
            {
                if (!string.IsNullOrWhiteSpace(propertyName))
                {
                    lock (_propertiesCurrentlyBeingValidated)
                    {
                        if (_propertiesCurrentlyBeingValidated.Contains(propertyName))
                        {
                            return;
                        }
                    }

                    ValidatePropertyUsingAnnotations(propertyName);
                }

                Validate();
            }
        }
        protected override void OnPropertyChanged(AdvancedPropertyChangedEventArgs e)
        {
            base.OnPropertyChanged(e);

            if (e.HasPropertyChanged(() => SelectedSpanType) || e.HasPropertyChanged(() => Amount))
            {
                switch (SelectedSpanType)
                {
                    case TimeSpanType.Years:
                        Value = TimeSpan.FromDays(Amount * AverageDaysInYear);
                        break;

                    case TimeSpanType.Months:
                        Value = TimeSpan.FromDays(Amount * AverageDaysInMonth);
                        break;

                    case TimeSpanType.Days:
                        Value = TimeSpan.FromDays(Amount);
                        break;

                    case TimeSpanType.Hours:
                        Value = TimeSpan.FromHours(Amount);
                        break;

                    case TimeSpanType.Minutes:
                        Value = TimeSpan.FromMinutes(Amount);
                        break;

                    case TimeSpanType.Seconds:
                        Value = TimeSpan.FromSeconds(Amount);
                        break;

                    default:
                        throw new NotSupportedException(string.Format("Type '{0}' is not supported.", SelectedSpanType));
                }
            }
        }
Exemple #12
0
        /// <summary>
        /// Invoked when a property value has changed.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="PropertyChangedEventArgs"/> instance containing the event data.</param>
        /// <param name="setDirtyAndAllowAutomaticValidation">if set to <c>true</c>, the <see cref="IsDirty"/> property is set and automatic validation is allowed.</param>
        /// <param name="isRefreshCallOnly">if set to <c>true</c>, the call is only to refresh updates (for example, for the IDataErrorInfo
        /// implementation). If this value is <c>false</c>, the custom change handlers will not be called.</param>
        private void RaisePropertyChanged(object sender, PropertyChangedEventArgs e, bool setDirtyAndAllowAutomaticValidation, bool isRefreshCallOnly)
        {
            if (string.IsNullOrEmpty(e.PropertyName))
            {
                if (!DisablePropertyChangeNotifications)
                {
                    // Call & exit, we can't handle "update them all" property change notifications
                    base.RaisePropertyChanged(this, new AdvancedPropertyChangedEventArgs(sender, e.PropertyName));
                }

                return;
            }

            // If this is an internal data object base property, just leave
            if (IsModelBaseProperty(e.PropertyName))
            {
                var senderAsModelBase = sender as ModelBase;
                if ((senderAsModelBase != null) && (string.Equals(e.PropertyName, IsDirtyProperty.Name, StringComparison.Ordinal)))
                {
                    // Maybe this is a child object informing us that it's not dirty any longer
                    if (senderAsModelBase.GetValue <bool>(e.PropertyName) == false)
                    {
                        if (!ReferenceEquals(this, sender))
                        {
                            // Ignore
                            return;
                        }
                    }

                    // A child became dirty, we are dirty as well
                    if (!ReferenceEquals(this, sender))
                    {
                        IsDirty = true;
                    }
                    else
                    {
                        if (!DisablePropertyChangeNotifications)
                        {
                            // Explicitly call base because we have overridden the behavior
                            var eventArgs = new AdvancedPropertyChangedEventArgs(sender, this, e.PropertyName);
                            base.RaisePropertyChanged(this, eventArgs);
                        }
                    }

                    return;
                }
            }

            if (HandlePropertyAndCollectionChanges)
            {
                if (ReferenceEquals(this, sender))
                {
                    AdvancedPropertyChangedEventArgs eventArgs;
                    var advancedEventArgs = e as AdvancedPropertyChangedEventArgs;
                    if (advancedEventArgs != null)
                    {
                        eventArgs = new AdvancedPropertyChangedEventArgs(this, advancedEventArgs);
                    }
                    else
                    {
                        eventArgs = new AdvancedPropertyChangedEventArgs(sender, this, e.PropertyName);
                    }

                    if (!isRefreshCallOnly)
                    {
                        if (IsPropertyRegistered(e.PropertyName))
                        {
                            var propertyData = GetPropertyData(e.PropertyName);
                            if (propertyData.PropertyChangedEventHandler != null)
                            {
                                propertyData.PropertyChangedEventHandler(this, eventArgs);
                            }
                        }
                    }

                    if (!DisablePropertyChangeNotifications)
                    {
                        // Explicitly call base because we have overridden the behavior
                        base.RaisePropertyChanged(this, eventArgs);
                    }
                }
            }

            SetDirtyAndAutomaticallyValidate(e.PropertyName, setDirtyAndAllowAutomaticValidation);
        }
Exemple #13
0
 /// <summary>
 /// Raises the <see cref="INotifyPropertyChanged.PropertyChanged"/> event.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="System.ComponentModel.PropertyChangedEventArgs"/> instance containing the event data.</param>
 /// <remarks>
 /// This method is overriden en does not call the base because lots of additional logic is added in this class. The
 /// <see cref="RaisePropertyChanged(object,System.ComponentModel.PropertyChangedEventArgs,bool,bool)"/> will explicitly call 
 /// <see cref="ObservableObject.RaisePropertyChanged(object, AdvancedPropertyChangedEventArgs)"/>.
 /// <para />
 /// If this method is overriden, it is very important to call the base.
 /// </remarks>
 protected override void RaisePropertyChanged(object sender, AdvancedPropertyChangedEventArgs e)
 {
     RaisePropertyChanged(sender, e, true, false);
 }
Exemple #14
0
        /// <summary>
        /// Invoked when a property value has changed.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="PropertyChangedEventArgs"/> instance containing the event data.</param>
        /// <param name="setDirtyAndAllowAutomaticValidation">if set to <c>true</c>, the <see cref="IsDirty"/> property is set and automatic validation is allowed.</param>
        /// <param name="isRefreshCallOnly">if set to <c>true</c>, the call is only to refresh updates (for example, for the IDataErrorInfo 
        /// implementation). If this value is <c>false</c>, the custom change handlers will not be called.</param>
        private void RaisePropertyChanged(object sender, PropertyChangedEventArgs e, bool setDirtyAndAllowAutomaticValidation, bool isRefreshCallOnly)
        {
            if (string.IsNullOrEmpty(e.PropertyName))
            {
                if (!DisablePropertyChangeNotifications)
                {
                    // Call & exit, we can't handle "update them all" property change notifications
                    base.RaisePropertyChanged(this, new AdvancedPropertyChangedEventArgs(sender, e.PropertyName));
                }

                return;
            }

            // If this is an internal data object base property, just leave
            if (IsModelBaseProperty(e.PropertyName))
            {
                var senderAsModelBase = sender as ModelBase;
                if ((senderAsModelBase != null) && (string.Equals(e.PropertyName, IsDirtyProperty.Name, StringComparison.Ordinal)))
                {
                    // Maybe this is a child object informing us that it's not dirty any longer
                    if (senderAsModelBase.GetValue<bool>(e.PropertyName) == false)
                    {
                        if (!ReferenceEquals(this, sender))
                        {
                            // Ignore
                            return;
                        }
                    }

                    // A child became dirty, we are dirty as well
                    if (!ReferenceEquals(this, sender))
                    {
                        IsDirty = true;
                    }
                    else
                    {
                        if (!DisablePropertyChangeNotifications)
                        {
                            // Explicitly call base because we have overridden the behavior
                            var eventArgs = new AdvancedPropertyChangedEventArgs(sender, this, e.PropertyName);
                            base.RaisePropertyChanged(this, eventArgs);
                        }
                    }

                    return;
                }
            }

            if (HandlePropertyAndCollectionChanges)
            {
                if (ReferenceEquals(this, sender))
                {
                    AdvancedPropertyChangedEventArgs eventArgs;
                    var advancedEventArgs = e as AdvancedPropertyChangedEventArgs;
                    if (advancedEventArgs != null)
                    {
                        eventArgs = new AdvancedPropertyChangedEventArgs(this, advancedEventArgs);
                    }
                    else
                    {
                        eventArgs = new AdvancedPropertyChangedEventArgs(sender, this, e.PropertyName);
                    }

                    if (!isRefreshCallOnly)
                    {
                        if (IsPropertyRegistered(e.PropertyName))
                        {
                            var propertyData = GetPropertyData(e.PropertyName);
                            if (propertyData.PropertyChangedEventHandler != null)
                            {
                                propertyData.PropertyChangedEventHandler(this, eventArgs);
                            }
                        }
                    }

                    if (!DisablePropertyChangeNotifications)
                    {
                        // Explicitly call base because we have overridden the behavior
                        base.RaisePropertyChanged(this, eventArgs);
                    }
                }
            }

            SetDirtyAndAutomaticallyValidate(e.PropertyName, setDirtyAndAllowAutomaticValidation);
        }
Exemple #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AdvancedPropertyChangedEventArgs"/>"/> class.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="Catel.Data.AdvancedPropertyChangedEventArgs"/>"/> instance containing the event data.</param>
 public AdvancedPropertyChangedEventArgs(object sender, AdvancedPropertyChangedEventArgs e)
     : this(e.OriginalSender, sender, e.PropertyName, e.OldValue, e.NewValue, e.IsOldValueMeaningful, e.IsNewValueMeaningful)
 {
 }
            public void CanAutomaticallyDetectNewValue()
            {
                var iniEntry = new IniEntry();
                iniEntry.Key = "mykey";

                var eventArgs = new AdvancedPropertyChangedEventArgs(iniEntry, "Key");

                Assert.AreEqual(iniEntry, eventArgs.OriginalSender);
                Assert.AreEqual(iniEntry, eventArgs.LatestSender);
                Assert.AreEqual("Key", eventArgs.PropertyName);
                Assert.AreEqual(null, eventArgs.OldValue);
                Assert.AreEqual("mykey", eventArgs.NewValue);
                Assert.AreEqual(false, eventArgs.IsOldValueMeaningful);
                Assert.AreEqual(true, eventArgs.IsNewValueMeaningful);
            }
 /// <summary>
 /// Raises the <see cref="ObservableObject.PropertyChanged"/> event.
 /// <para/>
 /// This is the one and only method that actually raises the <see cref="ObservableObject.PropertyChanged"/> event. All other
 /// methods are (and should be) just overloads that eventually call this method.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="System.ComponentModel.PropertyChangedEventArgs"/> instance containing the event data.</param>
 protected override void RaisePropertyChanged(object sender, AdvancedPropertyChangedEventArgs e)
 {
     _dispatcherService.BeginInvokeIfRequired(() => base.RaisePropertyChanged(sender, e));
 }
Exemple #18
0
 protected override void OnPropertyChanged(AdvancedPropertyChangedEventArgs e)
 {
     base.OnPropertyChanged(e);
     if (e.PropertyName == "MainScript")
     {
         this.HasChanges = true;
     }
 }
 /// <summary>
 /// Occurs when the value of the Person property is changed.
 /// </summary>
 /// <param name="e">
 /// The event argument
 /// </param>
 private void OnPersonChanged(AdvancedPropertyChangedEventArgs e)
 {
 }
        protected override void OnPropertyChanged(AdvancedPropertyChangedEventArgs e)
        {
            base.OnPropertyChanged(e);

            RaiseUpdated();
        }
            public void SetsValuesCorrectlyWithPropertyNameOnly()
            {
                var iniEntry = new IniEntry();
                var iniFile = new IniFile();

                var eventArgs = new AdvancedPropertyChangedEventArgs(iniEntry, iniFile, "PropertyName");

                Assert.AreEqual(iniEntry, eventArgs.OriginalSender);
                Assert.AreEqual(iniFile, eventArgs.LatestSender);
                Assert.AreEqual("PropertyName", eventArgs.PropertyName);
                Assert.AreEqual(null, eventArgs.OldValue);
                Assert.AreEqual(null, eventArgs.NewValue);
                Assert.AreEqual(false, eventArgs.IsOldValueMeaningful);
                Assert.AreEqual(false, eventArgs.IsNewValueMeaningful);
            }
 /// <summary>
 /// Initializes a new instance of the <see cref="AdvancedPropertyChangedEventArgs"/>"/> class.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="Catel.Data.AdvancedPropertyChangedEventArgs"/>"/> instance containing the event data.</param>
 public AdvancedPropertyChangedEventArgs(object sender, AdvancedPropertyChangedEventArgs e)
     : this(e.OriginalSender, sender, e.PropertyName, e.OldValue, e.NewValue, e.IsOldValueMeaningful, e.IsNewValueMeaningful) { }
Exemple #23
0
        /// <summary>
        /// Invoked when a property value has changed.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="PropertyChangedEventArgs"/> instance containing the event data.</param>
        /// <param name="updateIsDirty">if set to <c>true</c>, the <see cref="IsDirty"/> property is set and automatic validation is allowed.</param>
        /// <param name="isRefreshCallOnly">if set to <c>true</c>, the call is only to refresh updates (for example, for the IDataErrorInfo
        /// implementation). If this value is <c>false</c>, the custom change handlers will not be called.</param>
        protected void RaisePropertyChanged(object sender, PropertyChangedEventArgs e, bool updateIsDirty, bool isRefreshCallOnly)
        {
            if (string.IsNullOrEmpty(e.PropertyName))
            {
                if (!DisablePropertyChangeNotifications)
                {
                    // Call & exit, we can't handle "update them all" property change notifications
                    base.RaisePropertyChanged(this, new AdvancedPropertyChangedEventArgs(sender, e.PropertyName));
                }

                return;
            }

            // If this is an internal data object base property, just leave
            if (IsModelBaseProperty(e.PropertyName))
            {
                var senderAsModelBase = sender as ModelBase;
                if ((senderAsModelBase != null) && (string.Equals(e.PropertyName, IsDirtyProperty.Name, StringComparison.Ordinal)))
                {
                    // Maybe this is a child object informing us that it's not dirty any longer
                    if (!senderAsModelBase.GetValue <bool>(e.PropertyName) && !ReferenceEquals(this, sender))
                    {
                        // Ignore
                        return;
                    }

                    // A child became dirty, we are dirty as well
                    if (!ReferenceEquals(this, sender))
                    {
                        IsDirty = true;
                    }
                    else
                    {
                        if (!DisablePropertyChangeNotifications)
                        {
                            // Explicitly call base because we have overridden the behavior
                            var eventArgs = new AdvancedPropertyChangedEventArgs(sender, this, e.PropertyName);
                            base.RaisePropertyChanged(this, eventArgs);
                        }
                    }

                    return;
                }
            }

            if (ReferenceEquals(this, sender))
            {
                AdvancedPropertyChangedEventArgs eventArgs;
                var advancedEventArgs = e as AdvancedPropertyChangedEventArgs;
                if (advancedEventArgs != null)
                {
                    eventArgs = new AdvancedPropertyChangedEventArgs(this, advancedEventArgs);
                }
                else
                {
                    eventArgs = new AdvancedPropertyChangedEventArgs(sender, this, e.PropertyName);
                }

                if (!isRefreshCallOnly)
                {
                    SuspensionContext callbackSuspensionContext;

                    lock (_lock)
                    {
                        callbackSuspensionContext = _changeCallbacksSuspensionContext;
                    }

                    if (callbackSuspensionContext != null)
                    {
                        callbackSuspensionContext.Add(e.PropertyName);
                    }
                    else if (IsPropertyRegistered(e.PropertyName))
                    {
                        var propertyData = GetPropertyData(e.PropertyName);

                        var handler = propertyData.PropertyChangedEventHandler;
                        if (handler != null)
                        {
                            handler(this, eventArgs);
                        }
                    }
                }

                if (!DisablePropertyChangeNotifications)
                {
                    // Explicitly call base because we have overridden the behavior
                    base.RaisePropertyChanged(this, eventArgs);
                }
            }

            if (updateIsDirty)
            {
                SetDirty(e.PropertyName);
            }
        }
Exemple #24
0
 /// <summary>
 /// Called when the <see cref="PropertyChanged"/> event occurs.
 /// </summary>
 /// <param name="e">The <see cref="AdvancedPropertyChangedEventArgs"/> instance containing the event data.</param>
 protected virtual void OnPropertyChanged(AdvancedPropertyChangedEventArgs e)
 {
 }
Exemple #25
0
 /// <summary>
 /// Raises the <see cref="INotifyPropertyChanged.PropertyChanged"/> event.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="System.ComponentModel.PropertyChangedEventArgs"/> instance containing the event data.</param>
 /// <remarks>
 /// This method is overriden en does not call the base because lots of additional logic is added in this class. The
 /// <see cref="RaisePropertyChanged(object,System.ComponentModel.PropertyChangedEventArgs,bool,bool)"/> will explicitly call
 /// <see cref="ObservableObject.RaisePropertyChanged(object, AdvancedPropertyChangedEventArgs)"/>.
 /// <para />
 /// If this method is overriden, it is very important to call the base.
 /// </remarks>
 protected override void RaisePropertyChanged(object sender, AdvancedPropertyChangedEventArgs e)
 {
     RaisePropertyChanged(sender, e, true, false);
 }
 /// <summary>
 /// Raises the <see cref="ObservableObject.PropertyChanged"/> event.
 /// <para/>
 /// This is the one and only method that actually raises the <see cref="ObservableObject.PropertyChanged"/> event. All other
 /// methods are (and should be) just overloads that eventually call this method.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="System.ComponentModel.PropertyChangedEventArgs"/> instance containing the event data.</param>
 protected override void RaisePropertyChanged(object sender, AdvancedPropertyChangedEventArgs e)
 {
     _dispatcherService.BeginInvokeIfRequired(() => base.RaisePropertyChanged(sender, e));
 }
        /// <summary>
        /// Raises the <see cref="ObservableObject.PropertyChanged"/> event.
        /// <para/>
        /// This is the one and only method that actually raises the <see cref="ObservableObject.PropertyChanged"/> event. All other
        /// methods are (and should be) just overloads that eventually call this method.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.ComponentModel.PropertyChangedEventArgs"/> instance containing the event data.</param>
        protected override void RaisePropertyChanged(object sender, AdvancedPropertyChangedEventArgs e)
        {
            if (_isThrottlingEnabled && !_isHandlingThrottlingNotifications)
            {
                lock (_throttlingLockObject)
                {
                    _throttlingQueue[e.PropertyName] = DateTime.Now;
                }

                return;
            }

            if (DispatchPropertyChangedEvent)
            {
                _dispatcherService.BeginInvokeIfRequired(() => base.RaisePropertyChanged(sender, e));
            }
            else
            {
                base.RaisePropertyChanged(sender, e);
            }
        }
Exemple #28
0
 /// <summary>
 /// Raises the <see cref="PropertyChanged"/> event without allowing classes to override this behavior.
 /// <para />
 /// This is the one and only method that actually raises the <see cref="PropertyChanged"/> event. All other
 /// methods are (and should be) just overloads that eventually call this method.
 /// <para />
 /// Note that this method does not call <see cref="OnPropertyChanged(AdvancedPropertyChangedEventArgs)"/>. Use
 /// <see cref="RaisePropertyChanged(object, AdvancedPropertyChangedEventArgs)"/> if that is required.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="System.ComponentModel.PropertyChangedEventArgs"/> instance containing the event data.</param>
 protected void RaisePropertyChangedDirect(object sender, AdvancedPropertyChangedEventArgs e)
 {
     PropertyChanged?.Invoke(sender, e);
 }