Esempio n. 1
0
        public object GetValue(ValueNode target)
        {
            if (IsConst)
            {
                return(_constValue);
            }

            var source = GetSource(target);

            return(Convert(source.Value, target.CreateSerializationContext()));
        }
Esempio n. 2
0
        public void Bind(ValueNode target, Func <object> callback)
        {
            if (IsConst)
            {
                return;
            }

            var source = GetSource(target);

            source.TargetBindings.Add(() => ConvertBack(callback(), target.CreateSerializationContext()));
        }
Esempio n. 3
0
        public object GetBoundValue(ValueNode target)
        {
            if (IsConst)
            {
                return(_constValue);
            }

            var source = GetSource(target);

            var bindingSource = source as IBindingSource;

            if (bindingSource == null)
            {
                throw new InvalidOperationException("Not a bindable source.");
            }

            return(Convert(bindingSource.BoundValue, target.CreateSerializationContext()));
        }