/// <summary> /// Adds the properties of the selectedBox to the bag /// </summary> /// <param name="box">Box from where the properties should be /// loaded</param> /// <returns>A bag full of properties from the box</returns> protected PropertyTable CreatePropertiesFromBox(IBoxModule box) { //initializing a new bag PropertyTable bag = new PropertyTable(); //increasing the number of clicks of the user on the desktop bag.ClickID = IncreaseClickID(); IBoxModuleFactoryCreator creator = box.MadeInCreator; FerdaPropertySpec ps; bag.GetValue += new PropertySpecEventHandler(propertyBag_GetValue); bag.SetValue += new PropertySpecEventHandler(propertyBag_SetValue); //iterating through all the properties foreach (PropertyInfo pinfo in creator.Properties) { if (pinfo.visible) { if (box.IsPropertySetWithSettingModule(pinfo.name)) { //creating the "other" property if (IsOneBoxSelected) { CreateOtherProperty(pinfo, box, bag); } } else { //creating normal property //two known other property types - StringSeqT and CategoriesT if (pinfo.typeClassIceId == "::Ferda::Modules::StringSeqT" || pinfo.typeClassIceId == "::Ferda::Modules::CategoriesT") { CreateOtherProperty(pinfo, box, bag); continue; } //strings are also dealt with separatelly if (pinfo.typeClassIceId == "::Ferda::Modules::StringT") { CreateStringProperty(pinfo, box, bag); } else { string normalType = GetNormalType(pinfo.typeClassIceId); //This is a normal type, creating a normal property for it if (normalType != "") { //getting the displayable name of the property SocketInfo si = creator.GetSocket(pinfo.name); ps = new FerdaPropertySpec(si.label, normalType, false); ps.Category = pinfo.categoryName; //geting the socket information about the category ps.Description = si.hint; //it is readonly or it is already there as a socket - //cannot edit "socketed" value if (box.IsPropertyReadOnly(pinfo.name) || box.GetPropertySocking(pinfo.name)) { ps.Attributes = new Attribute[] { ReadOnlyAttribute.Yes }; } bag.Properties.Add(ps); AddAsyncTemporary(pinfo.name, normalType, false); } else { //throw new ApplicationException("Wierd type that we dont know!!!"); } } } } } return bag; }