private void getBoxModuleProperties(IBoxModule boxModule) { Debug.WriteLine("enterint test get properties ..."); PropertyInfo[] properties = boxModule.MadeInCreator.Properties; foreach (PropertyInfo property in properties) { string propertyName = property.name; Debug.WriteLine("try to get property " + propertyName); switch (property.typeClassIceId) { case "::Ferda::Modules::BoolT": boxModule.GetPropertyBool(propertyName); break; case "::Ferda::Modules::DateT": boxModule.GetPropertyDate(propertyName); break; case "::Ferda::Modules::DateTimeT": boxModule.GetPropertyDateTime(propertyName); break; case "::Ferda::Modules::DoubleT": boxModule.GetPropertyDouble(propertyName); break; case "::Ferda::Modules::FloatT": boxModule.GetPropertyFloat(propertyName); break; case "::Ferda::Modules::IntT": boxModule.GetPropertyInt(propertyName); break; case "::Ferda::Modules::LongT": boxModule.GetPropertyLong(propertyName); break; case "::Ferda::Modules::ShortT": boxModule.GetPropertyShort(propertyName); break; case "::Ferda::Modules::StringT": boxModule.GetPropertyString(propertyName); if (property.selectBoxParams != null && property.selectBoxParams.Length > 0) boxModule.GetPropertyOptions(propertyName); break; case "::Ferda::Modules::TimeT": boxModule.GetPropertyTime(propertyName); break; case "::Ferda::Modules::OtherT": //TODO break; } } Debug.WriteLine("leaving test get properties ..."); }
/// <summary> /// Creates a property for a "::Ferda::Modules::StringT". There can be not /// only string, but also types of ComboBoxes and this method decides, which /// FerdaPropertySpec will be created /// </summary> /// <param name="pinfo">Information about the property</param> /// <param name="box">Box where it finds the other property</param> /// <param name="bag">Bag where to put the FerdaPropertySpec</param> protected void CreateStringProperty(PropertyInfo pinfo, IBoxModule box, PropertyTable bag) { FerdaPropertySpec ps; SelectString[] array; //determining the type of the property array = box.GetPropertyOptions(pinfo.name); if (array.Length == 0) //it is a normal string property { SocketInfo si = box.MadeInCreator.GetSocket(pinfo.name); ps = new FerdaPropertySpec(si.label, typeof(string), false); ps.Category = pinfo.categoryName; ps.Description = si.hint; if (box.IsPropertyReadOnly(pinfo.name) || box.GetPropertySocking(pinfo.name)) { ps.Attributes = new Attribute[] { ReadOnlyAttribute.Yes }; } bag.Properties.Add(ps); //adding the asynch stuff AddAsyncTemporary(pinfo.name, "System.String", !IsOneBoxSelected); } else //a combo-box should be used { //if there are more boxes selected, the property should not be added if (!IsOneBoxSelected) { return; } if (box.ArePropertyOptionsObligatory(pinfo.name)) //this means user cannot edit values { SocketInfo si = box.MadeInCreator.GetSocket(pinfo.name); ps = new FerdaPropertySpec(si.label, typeof(StringSequence), false); ps.Category = pinfo.categoryName; ps.Description = si.hint; //atributes if (box.IsPropertyReadOnly(pinfo.name) || box.GetPropertySocking(pinfo.name)) { ps.Attributes = new Attribute[] { ReadOnlyAttribute.Yes, new EditorAttribute(typeof(StringComboEditor), typeof(System.Drawing.Design.UITypeEditor)), new TypeConverterAttribute(typeof(StringSequenceConverter)) }; } else { ps.Attributes = new Attribute[] { new EditorAttribute(typeof(StringComboEditor), typeof(System.Drawing.Design.UITypeEditor)), new TypeConverterAttribute(typeof(StringSequenceConverter)) }; } //adding to the bag bag.Properties.Add(ps); } else //user can add his own option to the string selection { SocketInfo si = box.MadeInCreator.GetSocket(pinfo.name); ps = new FerdaPropertySpec(si.label, typeof(StringSequence), false); ps.Description = si.hint; ps.Category = pinfo.categoryName; //atributes if (box.IsPropertyReadOnly(pinfo.name) || box.GetPropertySocking(pinfo.name)) { ps.Attributes = new Attribute[] { ReadOnlyAttribute.Yes, new EditorAttribute(typeof(StringComboAddingEditor), typeof(System.Drawing.Design.UITypeEditor)), new TypeConverterAttribute(typeof(StringSequenceConverter)) }; } else { ps.Attributes = new Attribute[] { new EditorAttribute(typeof(StringComboAddingEditor), typeof(System.Drawing.Design.UITypeEditor)), new TypeConverterAttribute(typeof(StringSequenceConverter)) }; } //adding to the bag bag.Properties.Add(ps); } //adding the asynch stuff if (IsOneBoxSelected) { AddAsyncTemporary(pinfo.name, "Ferda.FrontEnd.Properties.StringSequence", false); } } }