/// <summary>
        /// Creates a new <see cref="SettingDefinition"/> object.
        /// </summary>
        /// <param name="name">Unique name of the setting</param>
        /// <param name="defaultValue">Default value of the setting</param>
        /// <param name="displayName">Display name of the permission</param>
        /// <param name="group">Group of this setting</param>
        /// <param name="description">A brief description for this setting</param>
        /// <param name="scopes">Scopes of this setting. Default value: <see cref="SettingScopes.Application"/>.</param>
        /// <param name="isVisibleToClients">Can clients see this setting and it's value. Default: false</param>
        /// <param name="isInherited">Is this setting inherited from parent scopes. Default: True.</param>
        /// <param name="customData">Can be used to store a custom object related to this setting</param>
        public SettingDefinition(
            string name, 
            string defaultValue, 
            ILocalizableString displayName = null, 
            SettingDefinitionGroup group = null, 
            ILocalizableString description = null, 
            SettingScopes scopes = SettingScopes.Application, 
            bool isVisibleToClients = false, 
            bool isInherited = true,
            object customData = null)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("name");
            }

            Name = name;
            DefaultValue = defaultValue;
            DisplayName = displayName;
            Group = @group;
            Description = description;
            Scopes = scopes;
            IsVisibleToClients = isVisibleToClients;
            IsInherited = isInherited;
            CustomData = customData;
        }
        /// <summary>
        /// Creates a new <see cref="SettingDefinition"/> object.
        /// </summary>
        /// <param name="name">Unique name of the setting</param>
        /// <param name="defaultValue">Default value of the setting</param>
        /// <param name="displayName">Display name of the permission</param>
        /// <param name="group">Group of this setting</param>
        /// <param name="description">A brief description for this setting</param>
        /// <param name="scopes">Scopes of this setting. Default value: <see cref="SettingScopes.Application"/>.</param>
        /// <param name="isVisibleToClients">Can clients see this setting and it's value. Default: false</param>
        /// <param name="isInherited">Is this setting inherited from parent scopes. Default: True.</param>
        /// <param name="customData">Can be used to store a custom object related to this setting</param>
        public SettingDefinition(
            string name,
            string defaultValue,
            ILocalizableString displayName = null,
            SettingDefinitionGroup group   = null,
            ILocalizableString description = null,
            SettingScopes scopes           = SettingScopes.Application,
            bool isVisibleToClients        = false,
            bool isInherited  = true,
            object customData = null)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException(nameof(name));
            }

            Name               = name;
            DefaultValue       = defaultValue;
            DisplayName        = displayName;
            Group              = @group;
            Description        = description;
            Scopes             = scopes;
            IsVisibleToClients = isVisibleToClients;
            IsInherited        = isInherited;
            CustomData         = customData;
        }
 /// <summary>
 /// Creates a new <see cref="SettingDefinition"/> object.
 /// </summary>
 /// <param name="name">Unique name of the setting</param>
 /// <param name="defaultValue">Default value of the setting</param>
 /// <param name="displayName">Display name of the permission</param>
 /// <param name="group">Group of this setting</param>
 /// <param name="description">A brief description for this setting</param>
 /// <param name="scopes">Scopes of this setting</param>
 public SettingDefinition(string name, string defaultValue, LocalizableString displayName = null, SettingDefinitionGroup group = null, LocalizableString description = null, SettingScopes scopes = SettingScopes.Application)
 {
     Name = name;
     DefaultValue = defaultValue;
     DisplayName = displayName;
     Group = @group;
     Description = description;
     Scopes = scopes;
 }
 /// <summary>
 /// Creates a new <see cref="SettingDefinition"/> object.
 /// </summary>
 /// <param name="name">Unique name of the setting</param>
 /// <param name="defaultValue">Default value of the setting</param>
 /// <param name="displayName">Display name of the permission</param>
 /// <param name="group">Group of this setting</param>
 /// <param name="description">A brief description for this setting</param>
 /// <param name="scopes">Scopes of this setting. Default value: <see cref="SettingScopes.Application"/>.</param>
 /// <param name="isVisibleToClients">Can clients see this setting and it's value</param>
 public SettingDefinition(string name, string defaultValue, ILocalizableString displayName = null, SettingDefinitionGroup group = null, ILocalizableString description = null, SettingScopes scopes = SettingScopes.Application, bool isVisibleToClients = false)
 {
     Name = name;
     DefaultValue = defaultValue;
     DisplayName = displayName;
     Group = @group;
     Description = description;
     Scopes = scopes;
     IsVisibleToClients = isVisibleToClients;
 }
        /// <summary>
        /// Adds a <see cref="SettingDefinitionGroup"/> as child of this group.
        /// </summary>
        /// <param name="child">Child to be added</param>
        /// <returns>This child group to be able to add more child</returns>
        public SettingDefinitionGroup AddChild(SettingDefinitionGroup child)
        {
            if (child.Parent != null)
            {
                throw new AbpException("Setting group " + child.Name + " has already a Parent (" + child.Parent.Name + ").");
            }

            _children.Add(child);
            child.Parent = this;
            return this;
        }
Example #6
0
        /// <summary>
        /// Adds a <see cref="SettingDefinitionGroup"/> as child of this group.
        /// 添加一个 <see cref="SettingDefinitionGroup"/> 作为子组.
        /// </summary>
        /// <param name="child">Child to be added / 添加的子组</param>
        /// <returns>This child group to be able to add more child / 这个子组能够添加更多的子组</returns>
        public SettingDefinitionGroup AddChild(SettingDefinitionGroup child)
        {
            if (child.Parent != null)
            {
                throw new AbpException("Setting group " + child.Name + " has already a Parent (" + child.Parent.Name + ").");
            }

            _children.Add(child);
            child.Parent = this;
            return(this);
        }
        /// <summary>
        /// Creates a new <see cref="SettingDefinition"/> object.
        /// </summary>
        /// <param name="name">Unique name of the setting</param>
        /// <param name="defaultValue">Default value of the setting</param>
        /// <param name="displayName">Display name of the permission</param>
        /// <param name="group">Group of this setting</param>
        /// <param name="description">A brief description for this setting</param>
        /// <param name="scopes">Scopes of this setting. Default value: <see cref="SettingScopes.Application"/>.</param>
        /// <param name="isVisibleToClients">This parameter is obsolete. Use <paramref name="clientVisibilityProvider"/> instead! Default: false</param>
        /// <param name="isInherited">Is this setting inherited from parent scopes. Default: True.</param>
        /// <param name="customData">Can be used to store a custom object related to this setting</param>
        /// <param name="clientVisibilityProvider">Client visibility definition for the setting. Default: invisible</param>
        /// <param name="isEncrypted">Is this setting stored as encrypted in the data source.</param>
        public SettingDefinition(
            string name,
            string defaultValue,
            ILocalizableString displayName = null,
            SettingDefinitionGroup group   = null,
            ILocalizableString description = null,
            SettingScopes scopes           = SettingScopes.Application,
            bool isVisibleToClients        = false,
            bool isInherited  = true,
            object customData = null,
            ISettingClientVisibilityProvider clientVisibilityProvider = null,
            bool isEncrypted = false)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException(nameof(name));
            }

            Name         = name;
            DefaultValue = defaultValue;
            DisplayName  = displayName;
            Group        = @group;
            Description  = description;
            Scopes       = scopes;
            IsInherited  = isInherited;
            CustomData   = customData;
            IsEncrypted  = isEncrypted;

            ClientVisibilityProvider = new HiddenSettingClientVisibilityProvider();

            if (isVisibleToClients)
            {
                ClientVisibilityProvider = new VisibleSettingClientVisibilityProvider();
            }
            else if (clientVisibilityProvider != null)
            {
                ClientVisibilityProvider = clientVisibilityProvider;
            }
        }
 /// <summary>
 /// Creates a new <see cref="SettingDefinition"/> object.
 /// </summary>
 /// <param name="name">Unique name of the setting</param>
 /// <param name="defaultValue">Default value of the setting</param>
 /// <param name="displayName">Display name of the permission</param>
 /// <param name="group">Group of this setting</param>
 /// <param name="description">A brief description for this setting</param>
 /// <param name="scopes">Scopes of this setting. Default value: <see cref="SettingScopes.Application"/>.</param>
 /// <param name="isVisibleToClients">Can clients see this setting and it's value</param>
 public SettingDefinition(string name, string defaultValue, LocalizableString displayName = null, SettingDefinitionGroup group = null, LocalizableString description = null, SettingScopes scopes = SettingScopes.Application, bool isVisibleToClients = false)
 {
     Name               = name;
     DefaultValue       = defaultValue;
     DisplayName        = displayName;
     Group              = @group;
     Description        = description;
     Scopes             = scopes;
     IsVisibleToClients = isVisibleToClients;
 }
Example #9
0
        /// <summary>
        /// Creates a new <see cref="SettingDefinition"/> object.
        /// </summary>
        /// <param name="name">Unique name of the setting</param>
        /// <param name="defaultValue">Default value of the setting</param>
        /// <param name="displayName">Display name of the permission</param>
        /// <param name="group">Group of this setting</param>
        /// <param name="description">A brief description for this setting</param>
        /// <param name="scopes">Scopes of this setting. Default value: <see cref="SettingScopes.Application"/>.</param>
        /// <param name="isVisibleToClients">Can clients see this setting and it's value. Default: false</param>
        public SettingDefinition(string name, string defaultValue, ILocalizableString displayName = null, SettingDefinitionGroup group = null, ILocalizableString description = null, SettingScopes scopes = SettingScopes.Application, bool isVisibleToClients = false)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("name");
            }

            Name               = name;
            DefaultValue       = defaultValue;
            DisplayName        = displayName;
            Group              = @group;
            Description        = description;
            Scopes             = scopes;
            IsVisibleToClients = isVisibleToClients;
        }