コード例 #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;
 }