public CustomProperty( string sCategory, string sName, string sDescription, int identifier, ValueGetter g, ValueSetter s, bool bReadOnly, bool bVisible ) { this.sCategory = sCategory; this.sDescription = sDescription; this.sName = sName; this.bReadOnly = bReadOnly; this.bVisible = bVisible; this.identifier = identifier; this.getter = g; this.setter = s; valueType = g( identifier ).GetType(); readOnlyTester = delegate() { return bReadOnly; }; visibleTester = delegate() { return bVisible; }; }
void ApplyAttributes( object[] displayAttributes ) { readOnlyTester = delegate() { return bReadOnly; }; visibleTester = delegate() { return bVisible; }; foreach( object attribute in displayAttributes ) { Type t = attribute.GetType(); if( t == typeof( CategoryAttribute ) ) sCategory = ( ( CategoryAttribute )attribute ).m_strText; else if( t == typeof( DescriptionAttribute ) ) sDescription = ( ( DescriptionAttribute )attribute ).m_strText; else if( t == typeof( NameAttribute ) ) sName = ( ( NameAttribute )attribute ).m_strText; else if( t == typeof( ReadOnlyAttribute ) ) readOnlyTester = ( ( ReadOnlyAttribute )attribute ).GetDelegate( parent ); else if( t == typeof( VisibleAttribute ) ) visibleTester = ( ( VisibleAttribute )attribute ).GetDelegate( parent ); } }
public CustomProperty( string sCategory, string sName, string sDescription, string sPropertyName, object parent, bool bReadOnly, bool bVisible ) { this.sCategory = sCategory; this.sDescription = sDescription; this.sName = sName; this.bReadOnly = bReadOnly; this.bVisible = bVisible; this.parent = parent; this.parentType = parent.GetType(); // find the property property = parentType.GetProperty( sPropertyName ); valueType = property.PropertyType; readOnlyTester = delegate() { return bReadOnly; }; visibleTester = delegate() { return bVisible; }; }