public void Attach()
 {
     foreach (var dep in Dependencies)
     {
         dep.Successors.Set(this);
     }
     value = SL.SingleOrDefault(source);
 }
示例#2
0
 private void SourceCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     if (e.Action == NotifyCollectionChangedAction.Reset ||
         (e.OldItems != null && e.OldStartingIndex <= 0) ||
         (e.NewItems != null && e.NewStartingIndex <= 0))
     {
         SetValue(SL.SingleOrDefault(source));
     }
 }
        public INotificationResult Notify(IList <INotificationResult> sources)
        {
            var newValue = SL.SingleOrDefault(source);

            if (!EqualityComparer <TSource> .Default.Equals(value, newValue))
            {
                var oldValue = value;
                value = newValue;
                OnValueChanged(new ValueChangedEventArgs(oldValue, newValue));
                return(new ValueChangedNotificationResult <TSource>(this, oldValue, newValue));
            }

            return(UnchangedNotificationResult.Instance);
        }