示例#1
0
        public override void SetValue(object component, object value)
        {
            if (_pif == null)
            {
                return;
            }

            if (IsStatic)
            {
                //use the type to set the static value
                //indexers are treated as methods
                _pif.SetValue(typeof(T), value, null);
            }
            else
            {
                if (typeof(T).IsAbstract)
                {
                    if (_propertyValues == null)
                    {
                        _propertyValues = new Dictionary <string, object>();
                    }
                    if (_propertyValues.ContainsKey(_pif.Name))
                    {
                        _propertyValues[_pif.Name] = value;
                    }
                    else
                    {
                        _propertyValues.Add(_pif.Name, value);
                    }
                }
                else
                {
                    if (_owner != null)
                    {
                        _pif.SetValue(_owner, value, null);
                    }
                    else
                    {
                        _pif.SetValue(component, value, null);
                    }
                }
                IXType xt = component as IXType;
                if (xt != null)
                {
                    xt.OnCustomValueChanged(Name, value);
                }
            }
        }
示例#2
0
 public void OnCustomValueChanged(string name, object value)
 {
     if (_pointer != null && _pointer.Host != null)
     {
         ClassPointer h = _pointer.Host as ClassPointer;
         if (h != null)
         {
             IXType xt = h.ObjectList.GetObjectByID(_pointer.MemberId) as IXType;
             if (xt != null)
             {
                 xt.OnCustomValueChanged(name, value);
             }
             h.NotifyChange(_pointer, _pointer.Name);
         }
     }
 }