public static ClassMember Intercept(ClassMember member)
 {
     if (IsIndependent(member.UnderlyingType))
     {
         return(new ClassMemberIndependent(member));
     }
     else
     {
         return(member);
     }
 }
Exemplo n.º 2
0
 public override object TranslateOutgoingValue(object value)
 {
     if (value == null)
     {
         return(null);
     }
     if (ClassProperty.UnderlyingType == typeof(object) && (ClassMember.IsPrimitive(value.GetType()) || typeof(IEnumerable).IsAssignableFrom(value.GetType())))
     {
         return(value);
     }
     return(WrapObject(value));
 }
        public ObjectPropertyCollection(IObjectInstance objectInstance, ClassMember classProperty)
            : base(objectInstance, classProperty)
        {
            if (ClassProperty.CanRead)
            {
                // When the collection is out of date, update it from the wrapped object.
                _depCollection = new Dependent(() => BindingInterceptor.Current.UpdateValue(this));

                // When the property becomes out of date, trigger an update.
                _depCollection.Invalidated += TriggerUpdate;
            }
        }
Exemplo n.º 4
0
 public ObjectPropertyAtom(IObjectInstance objectInstance, ClassMember classProperty)
     : base(objectInstance, classProperty)
 {
     if (ClassProperty.CanRead)
     {
         // When the property is out of date, update it from the wrapped object.
         _depProperty = new Dependent(() => BindingInterceptor.Current.UpdateValue(this));
         // When the property becomes out of date, trigger an update.
         // The update should have lower priority than user input & drawing,
         // to ensure that the app doesn't lock up in case a large model is
         // being updated outside the UI (e.g. via timers or the network).
         _depProperty.Invalidated += () => UpdateScheduler.ScheduleUpdate(this);
     }
 }
 public ObjectPropertyAtomNative(IObjectInstance objectInstance, ClassMember classProperty)
     : base(objectInstance, classProperty)
 {
 }
Exemplo n.º 6
0
 public ClassMemberCommand(MethodInfo method, ClassMember condition, Type objectInstanceType)
     : base(method.Name, typeof(ObjectPropertyCommand), objectInstanceType)
 {
     ExecuteMethod      = method;
     CanExecuteProperty = condition;
 }
Exemplo n.º 7
0
 public static ObjectProperty From(IObjectInstance objectInstance, ClassMember classProperty)
 {
     return(classProperty.MakeObjectProperty(objectInstance));
 }
Exemplo n.º 8
0
 public ObjectProperty(IObjectInstance objectInstance, ClassMember classProperty)
 {
     ObjectInstance = objectInstance;
     ClassProperty  = classProperty;
 }
 public ClassMemberIndependent(ClassMember independent)
     : base(independent.Name, UnwrapType(independent.UnderlyingType), independent.ComponentType)
 {
     _independent   = independent;
     _valueProperty = independent.UnderlyingType.GetProperty("Value");
 }
Exemplo n.º 10
0
 public ObjectProperty LookupProperty(ClassMember classProperty)
 {
     return(_properties.Single(p => p.ClassProperty == classProperty));
 }
 public ObjectPropertyCollectionNative(IObjectInstance objectInstance, ClassMember classProperty)
     : base(objectInstance, classProperty)
 {
 }