Beispiel #1
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>
 /// <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;
 }
Beispiel #2
0
 /// <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 Exception("Setting group " + child.Name + " has already a Parent (" + child.Parent.Name + ").");
     }
     _children.Add(child);
     child.Parent = this;
     return(this);
 }