예제 #1
0
            public NotificationHook(IEnumerable <TSourceDep> lefts, ICollection <TTargetDep> rights, ISynchronizationContext context, OneWaySynchronizationMultipleDependency <TSource, TTarget, TSourceDep, TTargetDep> parent)
            {
                Lefts   = lefts;
                Rights  = rights;
                Context = context;
                Parent  = parent;

                var notifier = lefts as INotifyCollectionChanged;

                if (notifier != null)
                {
                    notifier.CollectionChanged += LeftsChanged;
                }
            }
예제 #2
0
        public void SynchronizeManyRightToLeftOnly <TDepLeft, TDepRight>(SynchronizationRule <TDepLeft, TDepRight> rule, Expression <Func <TLeft, ICollection <TDepLeft> > > leftSelector, Expression <Func <TRight, IEnumerableExpression <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 OneWaySynchronizationMultipleDependency <TRight, TLeft, TDepRight, TDepLeft>(RightToLeft, rule.RightToLeft, rightSelector, leftSelector);

            RightToLeft.Dependencies.Add(dependency);
        }