示例#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;
 }