Ejemplo n.º 1
0
        public void Invalidate(BindingSide side)
        {
            switch (_flow)
            {
            case BindingFlow.TwoWay:
                if (side == BindingSide.A)
                {
                    Binder.RunAssign(_assignAB);
                }
                else
                {
                    Binder.RunAssign(_assignBA);
                }

                break;

            case BindingFlow.OneWay:
                if (side == BindingSide.B)
                {
                    Binder.RunAssign(_assignBA);
                }

                break;

            case BindingFlow.Reverse:
                if (side == BindingSide.A)
                {
                    Binder.RunAssign(_assignAB);
                }

                Binder.RunAssign(_assignBA);
                break;
            }
        }
Ejemplo n.º 2
0
 public void Invalidate(BindingSide <U> side)
 {
     if (_sideB == side)
     {
         Invalidate(BindingSide.B);
     }
 }
Ejemplo n.º 3
0
 public void Invalidate(BindingSide <T> side)
 {
     if (_sideA == side)
     {
         Invalidate(BindingSide.A);
     }
 }
Ejemplo n.º 4
0
 public void Subscribe(BindingSide side)
 {
     if (side == BindingSide.A && _handlerA != null)
     {
         _sideA.ChangeEvent.AddEventHandler(_sideA.Target, _handlerA);
     }
     else if (side == BindingSide.B && _handlerB != null)
     {
         _sideB.ChangeEvent.AddEventHandler(_sideB.Target, _handlerB);
     }
 }
Ejemplo n.º 5
0
        private static void GuardAssignAvailability <U>(BindingSide <T> sideTo, BindingSide <U> sideFrom)
        {
            if (!sideTo.CanWrite)
            {
                throw new BindingException("Target property can not be written.");
            }

            if (!sideFrom.CanRead)
            {
                throw new BindingException("Source property can not be read.");
            }
        }
Ejemplo n.º 6
0
        internal Delegate Assigner <U>(BindingSide <U> fromSide, Func <U, T> adapter)
        {
            GuardAssignAvailability(this, fromSide);

            return(AssignerFromExpression(_expressionBody, fromSide._expressionBody, adapter));
        }
Ejemplo n.º 7
0
        internal Delegate Assigner(BindingSide <T> fromSide)
        {
            GuardAssignAvailability(this, fromSide);

            return(AssignerFromExpression(_expressionBody, fromSide._expressionBody));
        }
Ejemplo n.º 8
0
 public static (BindingSide <T> SideA, BindingSide <U> SideB) To <T, U>(this BindingSide <T> sideA,
                                                                        Expression <Func <U> > propertyExpression)
 {
     return(sideA, new BindingSide <U>(propertyExpression));