Ejemplo n.º 1
0
 protected override void SetRightValue(INotifyReversableExpression <long> right, long left, long result)
 {
     if (left - right.Value != result)
     {
         right.Value = left - result;
     }
 }
Ejemplo n.º 2
0
 protected override void SetRightValue(INotifyReversableExpression <uint> right, uint left, uint result)
 {
     if (left / right.Value != result)
     {
         right.Value = left / result;
     }
 }
Ejemplo n.º 3
0
 protected override void SetLeftValue(INotifyReversableExpression <float> left, float right, float result)
 {
     if (left.Value / right != result)
     {
         left.Value = right * result;
     }
 }
Ejemplo n.º 4
0
 protected override void SetLeftValue(INotifyReversableExpression <int> left, int right, int result)
 {
     if (left.Value + right != result)
     {
         left.Value = result - right;
     }
 }
Ejemplo n.º 5
0
 protected override void SetRightValue(INotifyReversableExpression <int> right, int left, int result)
 {
     if (left + right.Value != result)
     {
         right.Value = result - left;
     }
 }
Ejemplo n.º 6
0
 protected override void SetRightValue(INotifyReversableExpression <TRight> right, TLeft left, TResult result)
 {
     if (leftReverser != null)
     {
         right.Value = leftReverser(result, left);
     }
 }
Ejemplo n.º 7
0
 protected override void SetLeftValue(INotifyReversableExpression <TLeft> left, TRight right, TResult result)
 {
     if (rightReverser != null)
     {
         left.Value = rightReverser(result, right);
     }
 }
Ejemplo n.º 8
0
 protected override void SetRightValue(INotifyReversableExpression <double> right, double left, double result)
 {
     if (left - right.Value != result)
     {
         right.Value = left - result;
     }
 }
Ejemplo n.º 9
0
 protected override void SetRightValue(INotifyReversableExpression <float> right, float left, float result)
 {
     if (left - right.Value != result)
     {
         right.Value = left - result;
     }
 }
Ejemplo n.º 10
0
        public ObservableReversablePropertyMemberBinding(INotifyExpression <T> target, string memberName, Func <T, TMember> memberGet, Action <T, TMember> memberSet, INotifyReversableExpression <TMember> value)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }
            if (memberName == null)
            {
                throw new ArgumentNullException("memberName");
            }
            if (memberGet == null)
            {
                throw new ArgumentNullException("memberGet");
            }
            if (memberSet == null)
            {
                throw new ArgumentNullException("memberSet");
            }
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            Value      = value;
            MemberName = memberName;
            MemberGet  = memberGet;
            MemberSet  = memberSet;
            Target     = target;
            listener   = new PropertyChangeListener(this);
        }
Ejemplo n.º 11
0
 protected override void SetLeftValue(INotifyReversableExpression <long> left, long right, long result)
 {
     if (left.Value - right != result)
     {
         left.Value = right + result;
     }
 }
Ejemplo n.º 12
0
 protected override void SetLeftValue(INotifyReversableExpression <double> left, double right, double result)
 {
     if (left.Value * right != result)
     {
         left.Value = result / right;
     }
 }
Ejemplo n.º 13
0
 protected override void SetRightValue(INotifyReversableExpression <string> right, string left, string result)
 {
     if (string.IsNullOrEmpty(left))
     {
         right.Value = result;
     }
     else if (left + right.Value != result && result != null && result.StartsWith(left))
     {
         right.Value = result.Substring(left.Length);
     }
 }
Ejemplo n.º 14
0
 protected override void SetLeftValue(INotifyReversableExpression <string> left, string right, string result)
 {
     if (string.IsNullOrEmpty(right))
     {
         left.Value = result;
     }
     else if (left.Value + right != result && result != null && result.EndsWith(right))
     {
         left.Value = result.Substring(0, result.Length - right.Length);
     }
 }
Ejemplo n.º 15
0
 private void Coalesce(INotifyReversableExpression <IModelElement> coalesceValue)
 {
     if (ReferencedElement == null)
     {
         ReferencedElement = coalesceValue;
     }
     else
     {
         ReferencedElement = Observable.Coalesce(ReferencedElement, coalesceValue);
     }
 }
Ejemplo n.º 16
0
 private void Coalesce(INotifyReversableExpression<object> coalesceValue)
 {
     if (Value == null)
     {
         Value = coalesceValue;
     }
     else
     {
         Value = Observable.Coalesce(Value, coalesceValue);
     }
 }
Ejemplo n.º 17
0
 protected override void SetValue(INotifyReversableExpression <TInner> inner, TOuter value)
 {
     try
     {
         inner.Value = (TInner)System.Convert.ChangeType(value, typeof(TInner));
     }
     catch (InvalidCastException ex)
     {
         // Swallow
         Debug.WriteLine("Cast failed: " + ex.Message);
     }
 }
Ejemplo n.º 18
0
        internal NotifyReversableValue(INotifyReversableExpression <T> expression)
        {
            if (expression == null)
            {
                throw new ArgumentNullException("expression");
            }

            Expression = expression;

            Successors.Attached += (obj, e) => Attach();
            Successors.Detached += (obj, e) => Detach();
        }
Ejemplo n.º 19
0
        internal NotifyReversableValue(INotifyReversableExpression <T> expression)
        {
            if (expression == null)
            {
                throw new ArgumentNullException("expression");
            }

            Expression = expression;
            if (!expression.IsAttached)
            {
                expression.Attach();
            }
            expression.ValueChanged += ExpressionValueChanged;
        }
Ejemplo n.º 20
0
 protected abstract void SetValue(INotifyReversableExpression <TInner> inner, TOuter value);
Ejemplo n.º 21
0
 protected override void SetValue(INotifyReversableExpression <double> inner, double value)
 {
     inner.Value = -value;
 }
Ejemplo n.º 22
0
 protected override void SetValue(INotifyReversableExpression <decimal> inner, decimal value)
 {
     inner.Value = -value;
 }
Ejemplo n.º 23
0
 public ObservableReversableBoxExpression(INotifyReversableExpression <T> inner) : base(inner)
 {
 }
Ejemplo n.º 24
0
 protected override void SetValue(INotifyReversableExpression <float> inner, float value)
 {
     inner.Value = -value;
 }
Ejemplo n.º 25
0
 protected override void SetValue(INotifyReversableExpression <long> inner, long value)
 {
     inner.Value = -value;
 }
Ejemplo n.º 26
0
 protected abstract void SetRightValue(INotifyReversableExpression <TRight> right, TLeft left, TResult result);
Ejemplo n.º 27
0
 protected override void SetLeftValue(INotifyReversableExpression <uint> left, uint right, uint result)
 {
     left.Value = right ^ result;
 }
Ejemplo n.º 28
0
 protected override void SetRightValue(INotifyReversableExpression <int> right, int left, int result)
 {
     right.Value = left ^ result;
 }
Ejemplo n.º 29
0
 protected override void SetRightValue(INotifyReversableExpression <ulong> right, ulong left, ulong result)
 {
     right.Value = left ^ result;
 }
Ejemplo n.º 30
0
 public ObservableReversableCoalesceExpression(INotifyReversableExpression <T> left, INotifyReversableExpression <T> right)
     : base(left, right)
 {
 }