public ProfileSettingsEditor(ClientProfile profile) : this() { m_profile = profile; TypeDescriptorSurrogate tds = new TypeDescriptorSurrogate(profile); this.pg.SelectedObject = tds; }
public PropertyDescriptorEx(string name, string propertyName, string category, object defaultValue, string description, string editorName, string converterName, Type propertyType, bool readOnly, Attribute[] attributes, MethodInfo getMethod, MethodInfo setMethod, TypeDescriptorSurrogate surrogate) : base(name, attributes) { m_sur = surrogate; m_name = name; m_propertyName = propertyName; m_category = category; m_defVal = defaultValue; m_desc = description; m_editorName = editorName; m_typeConverter = converterName; m_type = propertyType; m_isRO = readOnly; m_atts = attributes; m_getMethod = getMethod; m_setMethod = setMethod; if (propertyType.IsEnum) { lock (s_enumTypeConverterMap) { if (!s_enumTypeConverterMap.ContainsKey(propertyType)) { Type enumTypeConverter = typeof(EnumTypeConverter <int>).GetGenericTypeDefinition(); Type constructedConverter = enumTypeConverter.MakeGenericType(propertyType); s_enumTypeConverterMap.Add(propertyType, constructedConverter); } m_converterType = s_enumTypeConverterMap[propertyType]; } if (propertyType.GetCustomAttributes(typeof(FlagsAttribute), false).Length > 0) { m_editorType = typeof(FlagsEnumTypeEditor <int>).GetGenericTypeDefinition().MakeGenericType(propertyType); } else { if (!object.ReferenceEquals(null, editorName)) { m_editorType = Type.GetType(editorName, false); } } } else { if (!object.ReferenceEquals(converterName, null)) { m_converterType = Type.GetType(converterName, false); } if (!object.ReferenceEquals(null, editorName)) { m_editorType = Type.GetType(editorName, false); } } }
public PropertyDescriptorEx(string name, string propertyName, string category, object defaultValue, string description, string editorName, string converterName, Type propertyType, bool readOnly, Attribute[] attributes, MethodInfo getMethod, MethodInfo setMethod, TypeDescriptorSurrogate surrogate) : base(name, attributes) { m_sur = surrogate; m_name = name; m_propertyName = propertyName; m_category = category; m_defVal = defaultValue; m_desc = description; m_editorName = editorName; m_typeConverter = converterName; m_type = propertyType; m_isRO = readOnly; m_atts = attributes; m_getMethod = getMethod; m_setMethod = setMethod; if (propertyType.IsEnum) { lock (s_enumTypeConverterMap) { if (!s_enumTypeConverterMap.ContainsKey(propertyType)) { Type enumTypeConverter = typeof(EnumTypeConverter<int>).GetGenericTypeDefinition(); Type constructedConverter = enumTypeConverter.MakeGenericType(propertyType); s_enumTypeConverterMap.Add(propertyType, constructedConverter); } m_converterType = s_enumTypeConverterMap[propertyType]; } if (propertyType.GetCustomAttributes(typeof(FlagsAttribute), false).Length > 0) { m_editorType = typeof(FlagsEnumTypeEditor<int>).GetGenericTypeDefinition().MakeGenericType(propertyType); } else { if (!object.ReferenceEquals(null, editorName)) m_editorType = Type.GetType(editorName, false); } } else { if (!object.ReferenceEquals(converterName, null)) m_converterType = Type.GetType(converterName, false); if (!object.ReferenceEquals(null, editorName)) m_editorType = Type.GetType(editorName, false); } }