internal PropertyMetadata <T> NotifyChanged(PropertyValueChangedArgs <T> pvc)
        {
            if (this.propertyChangedHandler != null)
            {
                this.propertyChangedHandler(pvc);
            }

            return(this);
        }
Ejemplo n.º 2
0
        protected void SetPropertyValueCore <T>(string propertyName, T data, PropertyValueChanged <T> pvc)
        {
            var oldValue = this.GetPropertyValue <T>(propertyName);

            if (!Object.Equals(oldValue, data))
            {
                if (this.valuesBag.ContainsKey(propertyName))
                {
                    this.valuesBag[propertyName] = new PropertyValue <T>(data);
                }
                else
                {
                    this.valuesBag.Add(propertyName, new PropertyValue <T>(data));
                }

                var args = new PropertyValueChangedArgs <T>(data, oldValue);
                if (pvc != null)
                {
                    pvc(args);
                }

                var metadata = this.GetPropertyMetadata <T>(propertyName);
                if (metadata.NotifyChanges)
                {
                    this.OnPropertyChanged(propertyName);

                    metadata
                    .NotifyChanged(args)
                    .GetCascadeChangeNotifications()
                    .ForEach(s =>
                    {
                        this.OnPropertyChanged(s);
                    });
                }
            }
        }