Esempio n. 1
0
        /// <summary>
        /// Adds the property.
        /// </summary>
        /// <param name="propName">Name of the property.</param>
        /// <param name="propValue">The property value.</param>
        /// <param name="propDesc">The property desc.</param>
        /// <param name="propCat">The property cat.</param>
        /// <param name="propType">Type of the property.</param>
        /// <param name="isReadOnly">if set to <c>true</c> [is read only].</param>
        /// <param name="isExpandable">if set to <c>true</c> [is expandable].</param>
        public void AddProperty(string propName, object propValue, string propDesc,
                                string propCat, Type propType, bool isReadOnly, bool isExpandable)
        {
            DynamicProperty _property = new DynamicProperty(propName, propValue, propDesc, propCat,
                                                            propType, isReadOnly, isExpandable);

            propertyCollection.Add(_property);
            this.MaxLength = propName.Length;
            this.MaxLength = propValue.ToString().Length;
        }
Esempio n. 2
0
        private static void SaveSection(string sectionName, XmlDocument xmlDoc, PropertyDescriptorCollection props)
        {
            XmlNodeList _xmlNodes = xmlDoc.SelectNodes("configuration/" + sectionName + "/add");

            for (int i = 0; i < _xmlNodes.Count; i++)
            {
                DynamicProperty _property = (DynamicProperty)props[_xmlNodes[i].Attributes["key"].Value];

                if (_property != null)
                {
                    _xmlNodes[i].Attributes["value"].Value = _property.GetValue(null).ToString();

                    if (_property.Description != _property.Name)
                    {
                        if (_xmlNodes[i].Attributes["description"] != null)
                        {
                            _xmlNodes[i].Attributes["description"].Value = _property.Description;
                        }
                    }
                }
            }
        }