Exemplo n.º 1
0
        protected override void SetValue(object obj, object value)
        {
            IObjectInstance objectInsance = obj as IObjectInstance;
            ObjectProperty  property      = objectInsance.LookupProperty(this);

            property.OnUserInput(value);
        }
Exemplo n.º 2
0
        protected override object GetValue(object obj)
        {
            IObjectInstance objectInsance = obj as IObjectInstance;
            ObjectProperty  property      = objectInsance.LookupProperty(this);

            return(property.Value);
        }
Exemplo n.º 3
0
        private ObjectProperty GetObjectProperty(object component)
        {
            // Find the object property.
            IObjectInstance objectInstance = ((IObjectInstance)component);
            ObjectProperty  objectProperty = objectInstance.LookupProperty(this);

            return(objectProperty);
        }
Exemplo n.º 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();
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 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();
                }
            });
        }
Exemplo n.º 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);
        }
Exemplo n.º 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());
        }
Exemplo n.º 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);
        }
Exemplo n.º 11
0
 public virtual void UpdateValue(ObjectProperty property)
 {
     property.ContinueUpdateValue();
 }
Exemplo n.º 12
0
 public virtual void SetValue(ObjectProperty property, object value)
 {
     property.ContinueSetValue(value);
 }
Exemplo n.º 13
0
 public virtual object GetValue(ObjectProperty property)
 {
     return property.ContinueGetValue();
 }