Exemple #1
0
        /// <summary>Invoked on the changing of a property value through <see cref="SetProperty"/>. The default sends the correct messages through the <see cref="PropertyChanging"/> and <see cref="INotifyPropertyChanging.PropertyChanging"/> events.</summary>
        /// <typeparam name="T">The type of the property value.</typeparam>
        /// <param name="property">The <see cref="PropertyInfo"/> of the property that's changing.</param>
        /// <param name="oldValue">The old value of the property.</param>
        /// <param name="newValue">The new value of the property.</param>
        /// <param name="oldValueObject">A boxed version of the old value (in <paramref name="oldValue"/>) of the property, if <paramref name="objectsSet"/> is <c>true</c>. The default implementation will set this if any events need to be raised.</param>
        /// <param name="newValueObject">A boxed version of the new value (in <paramref name="newValue"/>) of the property, if <paramref name="objectsSet"/> is <c>true</c>. The default implementation will set this if any events need to be raised.</param>
        /// <param name="objectsSet">Whether <paramref name="oldValueObject"/> and <paramref name="newValueObject"/> are actual boxed versions of <paramref name="oldValue"/> and <paramref name="newValue"/>. The default implementation sets this to <c>true</c> if it has raised any events, and boxed the values.</param>
        /// <exception cref="ArgumentNullException"><paramref name="property"/> is <c>null</c>.</exception>
        protected virtual void OnPropertyChanging <T>(PropertyInfo property, ref T oldValue, ref T newValue, ref object oldValueObject, ref object newValueObject, ref bool objectsSet)
        {
            PropertyChangingEventArgs     baseEventArgs = null;
            RichPropertyChangingEventArgs eventArgs     = null;

            if (PropertyChanging != null && !objectsSet)
            {
                oldValueObject = oldValue;
                newValueObject = newValue;
                objectsSet     = true;
            }

            if (PropertyChanging != null)
            {
                baseEventArgs = eventArgs = new RichPropertyChangingEventArgs(property, oldValueObject, newValueObject);
            }
            else if (BasePropertyChanging != null)
            {
                baseEventArgs = new PropertyChangingEventArgs(property.Name);
            }

            if (PropertyChanging != null)
            {
                PropertyChanging.Invoke(this, eventArgs);
            }
            if (BasePropertyChanging != null)
            {
                BasePropertyChanging.Invoke(this, baseEventArgs);
            }
        }
 protected virtual void RaisePropertyChanging(string propertyName)
 {
     if (PropertyChanging != null)
     {
         PropertyChanging.Invoke(this, new PropertyChangingEventArgs(propertyName));
     }
 }
 public void OnPropertyChanging(string propertyName)
 {
     if (PropertyChanging != null)
     {
         PropertyChanging.Invoke(this, new PropertyChangingEventArgs(propertyName));
     }
 }
Exemple #4
0
 private void OnPropertyChanging(string property)
 {
     if (PropertyChanging != null)
     {
         if (!propertyChangingCache.ContainsKey(property))
         {
             propertyChangingCache.Add(property, new PropertyChangingEventArgs(property));
         }
         PropertyChanging.Invoke(this, propertyChangingCache[property]);
     }
 }
Exemple #5
0
        private void SelectionChanged(object sender, EventArgs e)
        {
            string propNameFromControl = string.Empty;

            if (IsLoaded)
            {
                IsChanged = true;
            }

            ComboBox cmbBox = sender as ComboBox;

            if (cmbBox != null)
            {
                propNameFromControl = cmbBox.Name.Replace("cmb", "");

                PropertyChanging.Invoke(this, new PropertyChangingEventArgs(propNameFromControl));
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propNameFromControl));
            }
        }
Exemple #6
0
        /// <summary>
        /// Triggers the PropertyChanging event.
        /// </summary>
        /// <param name="property">The property.</param>
        /// <exception cref="ArgumentNullException">property;property is null.</exception>
        protected internal void OnPropertyChanging(PropertyMetadata property)
        {
            if (property == null)
            {
                throw new ArgumentNullException(nameof(property), $"{nameof(property)} is null.");
            }

            if (PropertyChanging == null)
            {
                return;
            }

            PropertyChanging.Invoke(this, property.PropertyChangingEventArgs);

            if (property.AffectsCalculatedFields)
            {
                foreach (var affectedProperty in property.CalculatedFields)
                {
                    OnPropertyChanging(affectedProperty);
                }
            }
        }
 /// <inheritdoc/>
 void IReactiveObject.RaisePropertyChanging(PropertyChangingEventArgs args)
 {
     PropertyChanging?.Invoke(this, args);
 }
Exemple #8
0
 void OnPropertyChanging(PropertyChangingEventArgs args)
 {
     PropertyChanging?.Invoke(this, args);
 }
Exemple #9
0
 public virtual void OnPropertyChanging(string propertyName)
 {
     PropertyChanging?.Invoke(this, new PropertyChangingEventArgs(propertyName));
 }
Exemple #10
0
 protected virtual void OnPropertyChanging(string propertyName, object value)
 {
     PropertyChanging?.Invoke(this, new PropertyChangingEventArgs(propertyName));
 }
Exemple #11
0
 protected virtual void OnPropertyChanging(object sender, PropertyChangingEventArgs e) => PropertyChanging?.Invoke(sender, e);
Exemple #12
0
 public void InvokeEvents(String message)
 {
     myEvent.Invoke(this, new MyEventArgs($"Event: {message}"));
     PropertyChanging.Invoke(this, new PropertyChangingEventArgs($"Event: {message}"));
 }
Exemple #13
0
 protected void NotifyPropertyChanging([CallerMemberName] string propertyName = null)
 => PropertyChanging?.Invoke(this, new PropertyChangingEventArgs(propertyName));
Exemple #14
0
 /// <summary>
 ///     Raises the <see cref="PropertyChanging" /> event.
 /// </summary>
 /// <param name="e"> Details of the property that is changing. </param>
 protected virtual void OnPropertyChanging([NotNull] PropertyChangingEventArgs e)
 => PropertyChanging?.Invoke(this, e);
Exemple #15
0
 /// <summary>
 ///     This is the logic which is called to invoke the event.
 /// </summary>
 /// <param name="sender">object</param>
 /// <param name="eventArgs">PropertyChangingEventArgs</param>
 private void InvokePropertyChanging(object sender, PropertyChangingEventArgs eventArgs)
 {
     PropertyChanging?.Invoke(sender, eventArgs);
 }
Exemple #16
0
 //ACTUALIZA LA INFORMACION DE LA PROPIEDAD CADA QUE SE DECTECTA UN CAMBIO MINIMO
 private void OnPropertyChanged([CallerMemberName] string nombre = "")
 {
     PropertyChanging?.Invoke(this, new PropertyChangingEventArgs(nombre));
 }
Exemple #17
0
 protected void RaisePropertyChanging(string propertyName)
 {
     PropertyChanging?.Invoke(this, new PropertyChangingEventArgs(propertyName));
 }
Exemple #18
0
 protected void NotifyPropertyChanging([CallerMemberName] string name = "")
 {
     PropertyChanging?.Invoke(this, new PropertyChangingEventArgs(name));
 }
 protected virtual void SendPropertyChanging()
 {
     PropertyChanging?.Invoke(this, emptyChangingEventArgs);
 }
 /// <summary>
 /// Invoke a property changing.
 /// </summary>
 /// <param name="propertyName">Name of the property that changed.</param>
 protected void OnPropertyChanging([CallerMemberName] string propertyName = "")
 {
     VerifyPropertyName(propertyName);
     PropertyChanging?.Invoke(this, new PropertyChangingEventArgs(propertyName));
 }
Exemple #21
0
 private void OnPropertyChanging(string propertyName)
 {
     PropertyChanging?.Invoke(this, new PropertyChangingEventArgs(propertyName));
 }
Exemple #22
0
 protected virtual void OnPropertyChanging()
 {
     PropertyChanging?.Invoke(this, new PropertyChangingEventArgs(Name));
 }
Exemple #23
0
 protected virtual void OnPropertyChanging([CallerMemberName] string propertyName = null)
 {
     PropertyChanging?.Invoke(this, new PropertyChangingEventArgs(propertyName));
 }
Exemple #24
0
 private void NotifyChanging(string propertyName)
 => PropertyChanging?.Invoke(this, new PropertyChangingEventArgs(propertyName));
Exemple #25
0
        private void OnPropertyChanging(string propertyName, Action action)
        {
            action?.Invoke();

            PropertyChanging?.Invoke(this, new PropertyChangingEventArgs(propertyName));
        }
Exemple #26
0
 public void RaisePropertyChanging(PropertyChangingEventArgs args)
 {
     PropertyChanging?.Invoke(this, args);
 }
 public void OnPropertyChanging(string propertyName, object before)
 {
     PropertyChanging?.Invoke(this, new PropertyChangingEventArgs(propertyName));
 }
 protected void OnPropertyChanging(PropertyChangingEventArgs propertyChangingEventArgs) => PropertyChanging?.Invoke(this, propertyChangingEventArgs);
Exemple #29
0
 /// <summary>
 /// 触发属性即将修改的通知事件。
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnPropertyChanging(PropertyChangingEventArgs e)
 {
     PropertyChanging.Invoke(this, e);
 }
Exemple #30
0
 private void NotifyPropertyChanging([CallerMemberName] string propertyName = "")
 {
     PropertyChanging?.Invoke(this, new PropertyChangingEventArgs(propertyName));
 }