コード例 #1
0
        protected override void SetValue(object obj, object value)
        {
            IObjectInstance objectInsance = obj as IObjectInstance;
            ObjectProperty  property      = objectInsance.LookupProperty(this);

            property.OnUserInput(value);
        }
コード例 #2
0
        protected override object GetValue(object obj)
        {
            IObjectInstance objectInsance = obj as IObjectInstance;
            ObjectProperty  property      = objectInsance.LookupProperty(this);

            return(property.Value);
        }
コード例 #3
0
        private ObjectProperty GetObjectProperty(object component)
        {
            // Find the object property.
            IObjectInstance objectInstance = ((IObjectInstance)component);
            ObjectProperty  objectProperty = objectInstance.LookupProperty(this);

            return(objectProperty);
        }
コード例 #4
0
        public ObjectInstance(object wrappedObject, Dispatcher dispatcher)
        {
            _wrappedObject = wrappedObject;
            _dispatcher    = dispatcher;

            // Create a wrapper around each property.
            _properties = _classInstance.ClassProperties.Select(p => ObjectProperty.From(this, p)).ToList();
        }
コード例 #5
0
        public ObjectProperty LookupProperty(ClassProperty classProperty)
        {
            ObjectProperty objectProperty;

            if (!_properties.TryGetValue(classProperty, out objectProperty))
            {
                objectProperty = ObjectProperty.From(this, classProperty);
                _properties.Add(classProperty, objectProperty);
            }
            return(objectProperty);
        }
コード例 #6
0
        // Called when the user edits the property. Sets the property in the wrapped object.
        private void OnPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            // Get the wrapped object.
            IObjectInstance objectInstance = (IObjectInstance)obj;
            object          wrappedObject  = objectInstance.WrappedObject;
            ObjectProperty  objectProperty = objectInstance.LookupProperty(this);

            if (objectProperty != null)
            {
                // Set the property in the wrapped object.
                object value = obj.GetValue(_dependencyProperty);
                objectProperty.OnUserInput(value);
            }
        }
コード例 #7
0
        public ObjectInstance(TWrappedObjectType wrappedObject, Tree tree)
        {
            _wrappedObject = wrappedObject;
            _tree          = tree;

            // Create a wrapper around each property.
            _properties = _classInstance.ClassProperties.Select(p => ObjectProperty.From(this, p)).ToList();

            _depNodes = new Dependent(delegate
            {
                foreach (ObjectProperty property in _properties)
                {
                    property.UpdateNodes();
                }
            });
        }
コード例 #8
0
        public ObjectProperty LookupProperty(CustomMemberProvider provider)
        {
            ObjectProperty dependentProperty;

            if (!_propertyByName.TryGetValue(provider, out dependentProperty))
            {
                PropertyInfo propertyInfo = _wrappedObject.GetType().GetRuntimeProperty(provider.Name);
                if (propertyInfo == null)
                {
                    return(null);
                }

                dependentProperty = new ObjectProperty(this, _wrappedObject, propertyInfo, provider);
                _propertyByName.Add(provider, dependentProperty);
            }
            return(dependentProperty);
        }
コード例 #9
0
        public object GetValue(object instance)
        {
            IObjectInstance obj = instance as IObjectInstance;

            if (obj == null)
            {
                return(null);
            }

            ObjectProperty property = obj.LookupProperty(this);

            if (property == null)
            {
                return(null);
            }

            return(property.GetValue());
        }
コード例 #10
0
        public void SetValue(object instance, object value)
        {
            IObjectInstance obj = instance as IObjectInstance;

            if (obj == null)
            {
                return;
            }

            ObjectProperty property = obj.LookupProperty(this);

            if (property == null)
            {
                return;
            }

            property.SetValue(value);
        }
コード例 #11
0
 public virtual void UpdateValue(ObjectProperty property)
 {
     property.ContinueUpdateValue();
 }
コード例 #12
0
 public virtual void SetValue(ObjectProperty property, object value)
 {
     property.ContinueSetValue(value);
 }
コード例 #13
0
 public virtual object GetValue(ObjectProperty property)
 {
     return property.ContinueGetValue();
 }