protected void Init(CustomPropertyDescriptor property, Parameter parameter)
        {
            if (!(parameter is NullParameter))
            {
                property.SetIsBrowsable(true);
                property.SetDescription(parameter.description);
                property.SetDisplayName(parameter.name);
                if (parameter is SwitchParameter)
                {
                    property.AddAttribute(new EditorAttribute(typeof(StandardValueEditor), typeof(UITypeEditor)));
                    ((SwitchParameter)parameter).AddValuesToProperty(property);
                }
                if (parameter is FlagParameter)
                    property.PropertyFlags |= PropertyFlags.IsFlag;

                if (parameter is StringParameter)
                {
                    property.AddAttribute(new TypeConverterAttribute(typeof(DataFromDBConverter)));
                    property.AddAttribute(new StorageTypeAttribute(((StringParameter)parameter).storageType));
                    property.AddAttribute(new EditorAttribute(typeof(ModalEditor), typeof(UITypeEditor)));
                }
            } else if ( parameter.GetValue()>0)
            {
                property.SetIsBrowsable(true);
                property.SetDisplayName("unused (" + property.DisplayName+")");
            }
        }
Beispiel #2
0
 public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
 {
     List<CustomPropertyDescriptor> tmpPDCLst = new List<CustomPropertyDescriptor>();
     PropertyDescriptorCollection tmpPDC = TypeDescriptor.GetProperties(currentSelectObject, attributes);
     IEnumerator tmpIe = tmpPDC.GetEnumerator();
     CustomPropertyDescriptor tmpCPD;
     PropertyDescriptor tmpPD;
     while (tmpIe.MoveNext())
     {
         tmpPD = tmpIe.Current as PropertyDescriptor;
         if (objectAttribs.ContainsKey(tmpPD.Name))
         {
             tmpCPD = new CustomPropertyDescriptor(currentSelectObject, tmpPD);
             tmpCPD.SetDisplayName(objectAttribs[tmpPD.Name]);
             tmpCPD.SetCategory(tmpPD.Category);
             tmpPDCLst.Add(tmpCPD);
         }
     }
     return new PropertyDescriptorCollection(tmpPDCLst.ToArray());
 }
 protected void Init(CustomPropertyDescriptor property, Parameter parameter)
 {
     if (!(parameter is NullParameter))
     {
         property.SetIsBrowsable(true);
         property.SetDescription(parameter.description);
         property.SetDisplayName(parameter.name);
         if (parameter is SwitchParameter)
             ((SwitchParameter)parameter).AddValuesToProperty(property);
         if (parameter is FlagParameter)
         {
             property.AddAttribute(new EditorAttribute(typeof(StandardValueEditor), typeof(UITypeEditor)));
             property.PropertyFlags |= PropertyFlags.IsFlag;
         }
     }
 }