Ejemplo n.º 1
0
 public ValueChangedEventArgs(IDependencyComponent component, IDependencyProperty property, IMaybe <object> oldValue, IMaybe <object> newValue)
 {
     Component = component;
     Property  = property;
     OldValue  = oldValue;
     NewValue  = newValue;
 }
Ejemplo n.º 2
0
        public void OnInheritanceParentChanged(IDependencyComponent oldParent, IDependencyComponent newParent)
        {
            var allSetProperties = new HashSet <IDependencyProperty>();

            if (oldParent != null)
            {
                oldParent.PropertyChanged -= OnParentPropertyChanged;

                foreach (var dp in oldParent.SetProperties)
                {
                    if (Component.GetMetadata(dp).IsInherited)
                    {
                        allSetProperties.Add(dp);
                    }
                }
            }

            if (newParent != null)
            {
                newParent.PropertyChanged += OnParentPropertyChanged;

                foreach (var dp in newParent.SetProperties)
                {
                    if (Component.GetMetadata(dp).IsInherited)
                    {
                        allSetProperties.Add(dp);
                    }
                }
            }

            foreach (var dp in allSetProperties)
            {
                var oldValue = oldParent != null
                    ? Maybe.FromValue(oldParent.GetValue(dp))
                    : Maybe.None <object>();

                var newValue = newParent != null
                    ? Maybe.FromValue(newParent.GetValue(dp))
                    : Maybe.None <object>();

                if (Helpers.AreDifferent(oldValue, newValue))
                {
                    ValueChanged?.Invoke(this, new ValueChangedEventArgs(Component, dp, oldValue, newValue));
                }
            }
        }
Ejemplo n.º 3
0
 public InheritanceValueSource(IDependencyComponent component, int order)
 {
     this.Component = component;
     this.Order     = order;
 }
Ejemplo n.º 4
0
 public ValueStoreBase(IDependencyComponent component, int order)
 {
     this.Component = component;
     this.Order     = order;
 }
Ejemplo n.º 5
0
        public IReadOnlyList <IValueSource> GetValueSources(IDependencyComponent component)
        {
            EnsureReadOnly();

            return(storeFactories.Select((p, i) => p.Value(component, i)).ToImmutableArray());
        }
Ejemplo n.º 6
0
 public LocalValueStore(IDependencyComponent component, int order) : base(component, order)
 {
 }
Ejemplo n.º 7
0
 public ValueStoreFake(IDependencyComponent component, int order) : base(component, order)
 {
 }