public CompositePathGetter
        (
            IEnumerable <IBindingPathLink <object> > pathLinks,
            PropertyType defaultValue
        )
        {
            _pathLinks = pathLinks;

            _defaultValue = defaultValue;

            if (pathLinks.IsNullOrEmpty())
            {
                PropGetters.Add(new SimplePropGetter <object>());
                return;
            }

            IObjWithPropGetter <object> previousPropGetter = null;

            foreach (var pathLink in _pathLinks)
            {
                IObjWithPropGetter <object> propGetter = pathLink.CreateGetter();

                PropGetters.Add(propGetter);

                if (previousPropGetter != null)
                {
                    IObjWithPropGetter <object> thePreviousPropGetter = previousPropGetter;
                    previousPropGetter.PropertyChangedEvent += () =>
                    {
                        propGetter.TheObj = thePreviousPropGetter.GetPropValue();
                    };
                }

                previousPropGetter = propGetter;
            }

            previousPropGetter.PropertyChangedEvent += () =>
            {
                if (this.PropertyChangedEvent == null)
                {
                    return;
                }

                if (!LastPropGetter.HasObj)
                {
                    _cachedValue.TheValue = _defaultValue;
                }
                else
                {
                    _cachedValue.TheValue = (PropertyType)LastPropGetter.GetPropValue();
                }

                PropertyChangedEvent?.Invoke();
            };
        }
コード例 #2
0
        public void Addiere(Aufgabe a)
        {
            // Aufgaben.Add(a); böse

            Aufgaben.Add(new Aufgabe
            {
                Text = a.Text,
                ID   = Aufgaben.Count
            });

            PropertyChangedEvent.Invoke(this, EventArgs.Empty);
        }
コード例 #3
0
ファイル: Notifier.cs プロジェクト: erchiguire/Fuxion
        protected virtual void OnRaisePropertyChanged <T>(string propertyName, T previousValue, T actualValue)
        {
            var action = new Action <string, T, T>((pro, pre, act) => {
                PropertyChangedEvent?.Invoke(this, new PropertyChangedEventArgs(pro));
                PropertyChanged?.Invoke(this as TNotifier, new NotifierPropertyChangedEventArgs <TNotifier>(pro, (TNotifier)(INotifier <TNotifier>) this, pre, act));
            });

            if (UseSynchronizerOnRaisePropertyChanged && Synchronizer != null)
            {
                Synchronizer.Invoke(action, propertyName, previousValue, actualValue).Wait();
            }
            else
            {
                action(propertyName, previousValue, actualValue);
            }
        }
コード例 #4
0
 public void TriggerPropertyChanged()
 {
     PropertyChangedEvent?.Invoke();
 }
コード例 #5
0
 protected virtual void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
 {
     PropertyChangedEvent?.Invoke(this, new PropertyChangedEventArgs(propertyName));
 }
コード例 #6
0
 private void ModifyEnum(int value)
 {
     OnValueChanged.Invoke(value, path);
 }
コード例 #7
0
 public void PropertyChanged()
 {
     PropertyChangedEvent?.Invoke(this, EventArgs.Empty);
 }
コード例 #8
0
 protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
 {
     PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
     PropertyChangedEvent?.Invoke(propertyName);
 }
コード例 #9
0
ファイル: NotificationObject.cs プロジェクト: Crash0/LetsTalk
 protected virtual void OnPropertyChanged(string propertyName)
 {
     PropertyChangedEvent?.Invoke(this, new PropertyChangedEventArgs(propertyName));
 }