コード例 #1
0
        public ObjectPropertyCollection(IObjectInstance objectInstance, ClassProperty classProperty)
            : base(objectInstance, classProperty)
        {
            if (ClassProperty.CanRead)
            {
                // When the collection is out of date, update it from the wrapped object.
                _depCollection = new Computed(OnUpdateCollection);

                // When the property becomes out of date, trigger an update.
                _depCollection.Invalidated += TriggerUpdate;
            }
        }
コード例 #2
0
        public ObjectPropertyCollection(IObjectInstance objectInstance, ClassProperty classProperty, bool hasChildObjects)
            : base(objectInstance, classProperty)
        {
            _hasChildObjects = hasChildObjects;

            if (ClassProperty.CanRead)
            {
                // Bind to the observable collection.
                ClassProperty.SetUserOutput(ObjectInstance, _collection);

                // When the collection is out of date, update it from the wrapped object.
                _depCollection = new Computed(OnUpdateCollection);
            }
        }
コード例 #3
0
        public ObjectPropertyAtom(IObjectInstance objectInstance, ClassProperty classProperty, bool hasChildObject)
            : base(objectInstance, classProperty)
        {
            _hasChildObject = hasChildObject;

            if (ClassProperty.CanRead)
            {
                // When the property is out of date, update it from the wrapped object.
                _depProperty = new Computed(delegate
                {
                    object value = ClassProperty.GetObjectValue(ObjectInstance.WrappedObject);
                    if (_hasChildObject)
                    {
                        IObjectInstance oldChild = _child;
                        object oldValue = oldChild == null ? null : oldChild.WrappedObject;

                        _child = null;
                        IObjectInstance wrapper;
                        if (value == null)
                            wrapper = null;
                        else if (value == oldValue)
                        {
                            wrapper = oldChild;
                            _child = wrapper;
                        }
                        else
                        {
                            if (WrapObject(value, out wrapper))
                                _child = wrapper;
                        }
                        ClassProperty.SetUserOutput(ObjectInstance, wrapper);

                        if (oldChild != _child && oldChild != null)
                        {
                            ObjectInstance.Tree.RemoveKey(oldValue);
                            oldChild.Dispose();
                        }
                    }
                    else
                    {
                        ClassProperty.SetUserOutput(ObjectInstance, value);
                    }
                });
            }
        }
コード例 #4
0
 public ObjectPropertyAtom(IObjectInstance objectInstance, ClassProperty classProperty)
     : base(objectInstance, classProperty)
 {
     if (ClassProperty.CanRead)
     {
         // When the property is out of date, update it from the wrapped object.
         _depProperty = new Computed(delegate
         {
             object value = ClassProperty.GetObjectValue(ObjectInstance.WrappedObject);
             value = TranslateOutgoingValue(value);
             if (!Object.Equals(_value, value))
                 _value = value;
             if (_firePropertyChanged)
                 ObjectInstance.FirePropertyChanged(ClassProperty.Name);
             _firePropertyChanged = true;
         });
         // When the property becomes out of date, trigger an update.
         _depProperty.Invalidated += () => UpdateScheduler.ScheduleUpdate(UpdateNow);
     }
 }
コード例 #5
0
 public ObjectPropertyAtom(IObjectInstance objectInstance, ClassProperty classProperty)
     : base(objectInstance, classProperty)
 {
     if (ClassProperty.CanRead)
     {
         // When the property is out of date, update it from the wrapped object.
         _depProperty = new Computed(delegate
         {
             object value = ClassProperty.GetObjectValue(ObjectInstance.WrappedObject);
             value        = TranslateOutgoingValue(value);
             if (!Object.Equals(_value, value))
             {
                 _value = value;
             }
             if (_firePropertyChanged)
             {
                 ObjectInstance.FirePropertyChanged(ClassProperty.Name);
             }
             _firePropertyChanged = true;
         });
         // When the property becomes out of date, trigger an update.
         _depProperty.Invalidated += () => UpdateScheduler.ScheduleUpdate(UpdateNow);
     }
 }
コード例 #6
0
 public ObjectPropertyCollectionNative(IObjectInstance objectInstance, ClassProperty classProperty)
     : base(objectInstance, classProperty)
 {
 }
コード例 #7
0
 public ObjectPropertyCollectionObject(IObjectInstance objectInstance, ClassProperty classProperty)
     : base(objectInstance, classProperty)
 {
 }
コード例 #8
0
 public ObjectPropertyAtomNative(IObjectInstance objectInstance, ClassProperty classProperty)
     : base(objectInstance, classProperty)
 {
 }
コード例 #9
0
 public static ObjectProperty From(IObjectInstance objectInstance, ClassProperty classProperty)
 {
     return classProperty.MakeObjectProperty(objectInstance);
 }
コード例 #10
0
 public ObjectProperty(IObjectInstance objectInstance, ClassProperty classProperty)
 {
     ObjectInstance = objectInstance;
     ClassProperty = classProperty;
 }
コード例 #11
0
 public static ObjectProperty From(IObjectInstance objectInstance, ClassProperty classProperty)
 {
     return(classProperty.MakeObjectProperty(objectInstance));
 }
コード例 #12
0
 public ObjectProperty(IObjectInstance objectInstance, ClassProperty classProperty)
 {
     ObjectInstance = objectInstance;
     ClassProperty  = classProperty;
 }
コード例 #13
0
 public ObjectPropertyAtomNative(IObjectInstance objectInstance, ClassProperty classProperty)
     : base(objectInstance, classProperty)
 {
 }