Пример #1
0
        public void SynchronizeRightToLeftOnly <TDepLeft, TDepRight>(SynchronizationRule <TDepLeft, TDepRight> rule, Expression <Func <TLeft, TDepLeft> > leftSelector, Expression <Func <TRight, TDepRight> > rightSelector, Expression <Func <TRight, bool> > guard = null)
            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 SynchronizationSingleDependency <TLeft, TRight, TDepLeft, TDepRight>(this, rule, leftSelector, rightSelector);
            var guardFunc  = ObservingFunc <TRight, bool> .FromExpression(guard);

            RightToLeft.Dependencies.Add(dependency.CreateRightToLeftOnlyDependency(guardFunc));
        }
 public GuardedRTLOnlyDependency(SynchronizationSingleDependency <TLeft, TRight, TDepLeft, TDepRight> parent, ObservingFunc <TRight, bool> guard)
 {
     this.parent = parent;
     this.guard  = guard;
 }
 public RTLOnlyDependency(SynchronizationSingleDependency <TLeft, TRight, TDepLeft, TDepRight> parent)
 {
     this.parent = parent;
 }
            public OneWayRTLDependency(INotifyValue <TDepRight> right, SynchronizationComputation <TRight, TLeft> computation, SynchronizationSingleDependency <TLeft, TRight, TDepLeft, TDepRight> parent)
            {
                Right       = right;
                Parent      = parent;
                Computation = computation;

                Right.ValueChanged += Left_ValueChanged;
            }
            public OneWayLTRSynchronization(INotifyValue <TDepLeft> left, SynchronizationComputation <TLeft, TRight> computation, SynchronizationSingleDependency <TLeft, TRight, TDepLeft, TDepRight> parent)
            {
                Left        = left;
                Parent      = parent;
                Computation = computation;

                Left.ValueChanged += Left_ValueChanged;
            }
            public TwoWaySynchronization(INotifyReversableValue <TDepLeft> left, INotifyReversableValue <TDepRight> right, SynchronizationComputation <TLeft, TRight> computation, SynchronizationSingleDependency <TLeft, TRight, TDepLeft, TDepRight> parent)
            {
                Left        = left;
                Right       = right;
                Parent      = parent;
                Computation = computation;

                Left.ValueChanged  += Left_ValueChanged;
                Right.ValueChanged += Right_ValueChanged;
            }