public static PropertyDefineCollection CreatePropertiesFromConfiguration(PropertyGroupConfigurationElement group)
        {
            PropertyDefineCollection pds = new PropertyDefineCollection();

            pds.LoadPropertiesFromConfiguration(group);

            return(pds);
        }
        public void AppendPropertiesFromConfiguration(string groupName)
        {
            ExceptionHelper.CheckStringIsNullOrEmpty(groupName, "groupName");

            PropertyGroupConfigurationElement group = PropertyGroupSettings.GetConfig().Groups[groupName];

            ExceptionHelper.FalseThrow <KeyNotFoundException>(group != null, "不能根据'{0}'找到对应的属性组定义", groupName);

            AppendPropertiesFromConfiguration(group);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 从配置信息初始化
        /// </summary>
        /// <param name="categoryName"></param>
        internal void InitFromConfiguration(PropertyGroupConfigurationElement elem)
        {
            this.Name        = elem.Name;
            this.Description = elem.Description;

            this._Properties = new PropertyValueCollection();

            PropertyDefineCollection definedProperties = new PropertyDefineCollection();

            definedProperties.LoadPropertiesFromConfiguration(elem);

            this._Properties.InitFromPropertyDefineCollection(definedProperties);
        }
 public void AppendPropertiesFromConfiguration(PropertyGroupConfigurationElement group)
 {
     if (group != null)
     {
         foreach (PropertyDefineConfigurationElement propDefineElement in group.AllProperties)
         {
             if (this.ContainsKey(propDefineElement.Name))
             {
                 //徐磊注释   2012/6/14
                 //if (propDefineElement.AllowOverride)
                 //{
                 //    this.Remove(pd => pd.Name == propDefineElement.Name);
                 //    this.Add(new PropertyDefine(propDefineElement));
                 //}
             }
             else
             {
                 this.Add(new PropertyDefine(propDefineElement));
             }
         }
     }
 }
        public void LoadPropertiesFromConfiguration(PropertyGroupConfigurationElement group)
        {
            this.Clear();

            AppendPropertiesFromConfiguration(group);
        }
Ejemplo n.º 6
0
 internal UserSettingsCategory(PropertyGroupConfigurationElement elem)
 {
     InitFromConfiguration(elem);
 }