public PropertyDescriptorCollection GetProperties(Attribute[] attributes) { PropertyDescriptorCollection ps = TypeDescriptor.GetProperties(this, attributes, true); List <PropertyDescriptor> list = new List <PropertyDescriptor>(); foreach (PropertyDescriptor p in ps) { if (string.CompareOrdinal(p.Name, "Value") == 0) { Attribute[] attrs; if (typeof(Keys).IsAssignableFrom(DataType.LibType)) { attrs = new Attribute[] { new EditorAttribute(typeof(TypeEditorKeys), typeof(UITypeEditor)) }; } else { attrs = new Attribute[] { }; } PropertyDescriptorValue tp = new PropertyDescriptorValue("Value", attrs, this.GetType().GetProperty("Value"), DataType.LibType, this.GetType()); list.Add(tp); } else { list.Add(p); } } return(new PropertyDescriptorCollection(list.ToArray())); }
public PropertyDescriptorCollection GetProperties(Attribute[] attributes) { PropertyDescriptorCollection ps = TypeDescriptor.GetProperties(this, attributes, true); List <PropertyDescriptor> list = new List <PropertyDescriptor>(); foreach (PropertyDescriptor p in ps) { if (string.Compare(p.Name, "DefaultValue", StringComparison.Ordinal) == 0) { PropertyDescriptorValue p0 = new PropertyDescriptorValue(p.Name, attributes, EPField.ToSystemType(_p.OleDbType), this); list.Add(p0); } else if (string.Compare(p.Name, "Name", StringComparison.Ordinal) == 0) { if (this.CanChangeName) { list.Add(p); } else { PropertyDescriptorForDisplay p0 = new PropertyDescriptorForDisplay(this.GetType(), "Name", this.Name, attributes); list.Add(p0); } } else { list.Add(p); } } ps = new PropertyDescriptorCollection(list.ToArray()); return(ps); }
public PropertyDescriptorCollection GetProperties(Attribute[] attributes) { PropertyDescriptor[] lst = new PropertyDescriptor[3]; int n = 0; Attribute[] attrs; if (attributes != null) { n = attributes.Length; attrs = new Attribute[n + 1]; if (attributes.Length > 0) { attributes.CopyTo(attrs, 0); } } else { attrs = new Attribute[n + 1]; } attrs[n] = new ParenthesizePropertyNameAttribute(true); lst[0] = new PropertyDescriptorName(ReadOnly, this, attrs); lst[1] = new PropertyDescriptorForDisplay(this.GetType(), "Type", _value.ValueType.Name, attributes); lst[2] = new PropertyDescriptorValue(ReadOnly, this, attributes); PropertyDescriptorCollection ps = new PropertyDescriptorCollection(lst); return(ps); }
public PropertyDescriptorCollection GetProperties(Attribute[] attributes) { PropertyDescriptorCollection ps = TypeDescriptor.GetProperties(this, attributes, true); List <PropertyDescriptor> list = new List <PropertyDescriptor>(); bool isString = typeof(string).Equals(_type); if (IsDataOnly) { foreach (PropertyDescriptor p in ps) { if ((string.CompareOrdinal(p.Name, "DefaultData") == 0) || (string.CompareOrdinal(p.Name, "DataType") == 0)) { PropertyDescriptorForDisplay p0 = new PropertyDescriptorForDisplay(this.GetType(), p.Name, VPLUtil.ObjectToString(p.GetValue(this)), attributes); list.Add(p0); } } } else { if (isString) { PropertyDescriptor[] a = new PropertyDescriptor[ps.Count]; ps.CopyTo(a, 0); list.AddRange(a); } else { //remove Encrypted if not a string value foreach (PropertyDescriptor p in ps) { if (string.CompareOrdinal(p.Name, "Encrypted") != 0) { list.Add(p); } } } } PropertyInfo pif = typeof(ConfigProperty).GetProperty("DefaultData"); PropertyDescriptorValue pv = new PropertyDescriptorValue("Data", attributes, pif, _type, typeof(ConfigProperty)); list.Add(pv); ps = new PropertyDescriptorCollection(list.ToArray()); return(ps); }