Пример #1
0
 public NotificationHook(ICollection <TDepLeft> lefts, ICollection <TDepRight> rights, ISynchronizationContext context, SynchronizationMultipleDependency <TLeft, TRight, TDepLeft, TDepRight> parent)
 {
     Lefts   = lefts;
     Rights  = rights;
     Context = context;
     Parent  = parent;
 }
Пример #2
0
        public void SynchronizeMany <TDepLeft, TDepRight>(SynchronizationRule <TDepLeft, TDepRight> rule, Expression <Func <TLeft, ICollectionExpression <TDepLeft> > > leftSelector, Expression <Func <TRight, ICollectionExpression <TDepRight> > > rightSelector)
            where TDepLeft : class
            where TDepRight : class
        {
            if (rule == null)
            {
                throw new ArgumentNullException("rule");
            }
            if (leftSelector == null)
            {
                throw new ArgumentNullException("leftSelector");
            }
            if (rightSelector == null)
            {
                throw new ArgumentNullException("rightSelector");
            }

            var dependency = new SynchronizationMultipleDependency <TLeft, TRight, TDepLeft, TDepRight>(this, rule, leftSelector, rightSelector);

            LeftToRight.Dependencies.Add(dependency.CreateLeftToRightDependency());
            RightToLeft.Dependencies.Add(dependency.CreateRightToLeftDependency());
        }
Пример #3
0
            public BidirectionalHook(ICollection <TDepLeft> lefts, ICollection <TDepRight> rights, ISynchronizationContext context, SynchronizationMultipleDependency <TLeft, TRight, TDepLeft, TDepRight> parent)
                : base(lefts, rights, context, parent)
            {
                var leftNotifier  = lefts as INotifyCollectionChanged;
                var rightNotifier = rights as INotifyCollectionChanged;

                if (leftNotifier != null)
                {
                    leftNotifier.CollectionChanged += LeftsChanged;
                }
                if (rightNotifier != null)
                {
                    rightNotifier.CollectionChanged += RightsChanged;
                }
            }
Пример #4
0
            public RightToLeftHook(ICollection <TDepLeft> lefts, ICollection <TDepRight> rights, ISynchronizationContext context, SynchronizationMultipleDependency <TLeft, TRight, TDepLeft, TDepRight> parent)
                : base(lefts, rights, context, parent)
            {
                var notifier = rights as INotifyCollectionChanged;

                if (notifier != null)
                {
                    notifier.CollectionChanged += RightsChanged;
                }
            }
Пример #5
0
 public RTLDependency(SynchronizationMultipleDependency <TLeft, TRight, TDepLeft, TDepRight> parent)
 {
     this.parent = parent;
 }