public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { IniPropertyDescriptor pd = (IniPropertyDescriptor)context.PropertyDescriptor; return(new StandardValuesCollection(pd.GetValidValues())); // AEDSObject instance = (AEDSObject) context.Instance; // return new StandardValuesCollection( instance.AedsType.GetValidProperties( context.PropertyDescriptor.Name ) ); }
private PropertyDescriptor GetPropertyDescriptor(XmlNode propertyNode, Attribute ca, string sectionName, bool deleteSectionIfEmpty) { DescriptionAttribute da = new DescriptionAttribute(propertyNode.Attributes["Comment"].Value); ArrayList attributes = new ArrayList(); attributes.Add(ca); attributes.Add(da); ArrayList values = null; TypeConverterAttribute tca = null; PropertyDescriptor pd = null; bool canBeEmpty = true; switch (propertyNode.Attributes["PropertyType"].Value) { case "FreeText": break; case "Number": canBeEmpty = propertyNode.Attributes["CanBeEmpty"].Value.Equals("true"); if (canBeEmpty) { tca = new TypeConverterAttribute(typeof(IniInt32Converter)); } else { tca = new TypeConverterAttribute(typeof(Int32Converter)); } attributes.Add(tca); break; case "Enum": tca = new TypeConverterAttribute(typeof(StaticDomainStringConverter)); canBeEmpty = propertyNode.Attributes["CanBeEmpty"].Value.Equals("true"); attributes.Add(tca); values = this.GetPropertyValues(propertyNode); if (canBeEmpty) { values.Insert(0, string.Empty); } break; } pd = new IniPropertyDescriptor(propertyNode.Attributes["Name"].Value, (Attribute[])attributes.ToArray(typeof(Attribute)), sectionName, propertyNode.Attributes["DeleteIfEmpty"].Value.Equals("true"), deleteSectionIfEmpty, values, this); return(pd); }