Exemple #1
0
        public static DZModulePropertyDescriptor CreateStringPropertyDescriptor(string propName,
                                                                                string displayName, string description, string category, bool readOnly)
        {
            ArrayList          attrs = CreateAttributes(displayName, description, category);
            PropertyDescriptor pd    = DZPropertyContainer.GetStringPD();

            return(new DZModulePropertyDescriptor(propName, pd, attrs, readOnly));
        }
Exemple #2
0
        public void CreatePropertyDescriptors(ArrayList props, bool specific)
        {
            string displayName = DisplayName;
            string description = Description;

            if (DownloadOffset > 0)
            {
                string compileInfo = string.Format("Data Type: {0}, Download Offset: {1}",
                                                   DataType, DownloadOffset);
                if (string.IsNullOrEmpty(description))
                {
                    description = compileInfo;
                }
                else
                {
                    description = compileInfo + "\r\n" + description;
                }
            }

            PropertyDescriptor basePD    = null;
            TypeConverter      converter = null;

            if (!string.IsNullOrEmpty(ValueList))
            {
                basePD = DZPropertyContainer.GetEnumPD();
                Dictionary <string, string> dic = ParseValueList(ValueList);
                converter = new DZEnumConverter(dic);
            }
            else if (string.Compare(DataType, "BOOL", true) == 0)
            {
                basePD = DZPropertyContainer.GetBoolPD();
            }
            else
            {
                basePD = DZPropertyContainer.GetStringPD();
            }

            ArrayList attrs = DZPropertyDescriptor.CreateAttributes(displayName, description,
                                                                    string.IsNullOrEmpty(Category) ? (specific ? "Specific" : "Common") : Category);

            DZModulePropertyDescriptor pd =
                new DZModulePropertyDescriptor(Name, basePD, attrs, ReadOnly);

            if (converter != null)
            {
                pd.SetConverter(converter);
            }
            // add pd into list
            props.Add(pd);

            // build pd for Address
            if (Address != null)
            {
                string addressCategory = string.IsNullOrEmpty(Address.Category) ? displayName : Address.Category;
                basePD = DZPropertyContainer.GetStringPD();
                //
                attrs = DZPropertyDescriptor.CreateAttributes("Allowed CPU Type(s)", "Allowed CPU Type(s) of " + displayName, addressCategory);
                props.Add(new DZModulePropertyDescriptor(GetAddressPropName("allowedCPUTypes"), basePD, attrs, true));
                attrs = DZPropertyDescriptor.CreateAttributes("Allowed FB Type(s)", "Allowed Function Block Type(s) of " + displayName, addressCategory);
                props.Add(new DZModulePropertyDescriptor(GetAddressPropName("allowedFunctionBlockTypes"), basePD, attrs, true));
                attrs = DZPropertyDescriptor.CreateAttributes("Allowed VME Slot(s)", "Allowed VME Slot(s) of " + displayName, addressCategory);
                props.Add(new DZModulePropertyDescriptor(GetAddressPropName("allowedVMESlots"), basePD, attrs, true));
                attrs = DZPropertyDescriptor.CreateAttributes("VME Bus Address", "VME Bus Address of " + displayName, addressCategory);
                props.Add(new DZModulePropertyDescriptor(GetAddressPropName("vmeBusAddress"), basePD, attrs, true));
                attrs = DZPropertyDescriptor.CreateAttributes("Unique Address ID", "Unique Address ID of " + displayName, addressCategory);
                props.Add(new DZModulePropertyDescriptor(GetAddressPropName("uniqueAddressID"), basePD, attrs, true));
            }
        }