Class ActionGroupModuleBuilder
- Namespace
- Kook
- Assembly
- Kook.Net.Core.dll
Represents a action group module builder for creating an ActionGroupModule.
public class ActionGroupModuleBuilder : IModuleBuilder, IEquatable<ActionGroupModuleBuilder>, IEquatable<IModuleBuilder>
- Inheritance
-
ActionGroupModuleBuilder
- Implements
- Inherited Members
Constructors
ActionGroupModuleBuilder()
Initializes a new instance of the ActionGroupModuleBuilder class.
public ActionGroupModuleBuilder()
ActionGroupModuleBuilder(IList<ButtonElementBuilder>)
Initializes a new instance of the ActionGroupModuleBuilder class.
public ActionGroupModuleBuilder(IList<ButtonElementBuilder> elements)
Parameters
elements
IList<ButtonElementBuilder>
Fields
MaxElementCount
Returns the maximum number of elements allowed by Kook.
public const int MaxElementCount = 4
Field Value
Properties
Elements
Gets or sets the button elements of the action group module.
public IList<ButtonElementBuilder> Elements { get; set; }
Property Value
- IList<ButtonElementBuilder>
An IList<T> containing the button elements of the action group module.
Type
Specifies the module type of the IModule this builder creates.
public ModuleType Type { get; }
Property Value
- ModuleType
A ModuleType representing the module type of the IModule this builder creates.
Methods
AddElement(ButtonElementBuilder)
Adds a button element to the action group module.
public ActionGroupModuleBuilder AddElement(ButtonElementBuilder field)
Parameters
field
ButtonElementBuilderThe button element to add.
Returns
- ActionGroupModuleBuilder
The current builder.
AddElement(Action<ButtonElementBuilder>?)
Adds a button element to the action group module.
public ActionGroupModuleBuilder AddElement(Action<ButtonElementBuilder>? action = null)
Parameters
action
Action<ButtonElementBuilder>The action to add a button element to the action group module.
Returns
- ActionGroupModuleBuilder
The current builder.
Exceptions
- ArgumentException
The addition operation would cause the number of elements to exceed MaxElementCount.
Build()
Builds this builder into an ActionGroupModule.
public ActionGroupModule Build()
Returns
- ActionGroupModule
An ActionGroupModule representing the built action group module object.
Exceptions
- ArgumentNullException
Elements is null.
- ArgumentException
Elements is an empty list.
- ArgumentException
The number of elements of Elements is greater than MaxElementCount.
Equals(ActionGroupModuleBuilder?)
Determines whether the specified ActionGroupModuleBuilder is equal to the current ActionGroupModuleBuilder.
public bool Equals(ActionGroupModuleBuilder? actionGroupModuleBuilder)
Parameters
actionGroupModuleBuilder
ActionGroupModuleBuilderThe ActionGroupModuleBuilder to compare with the current ActionGroupModuleBuilder.
Returns
- bool
true
if the specified ActionGroupModuleBuilder is equal to the current ActionGroupModuleBuilder; otherwise,false
.
Equals(object?)
Determines whether the specified ActionGroupModuleBuilder is equal to the current ActionGroupModuleBuilder.
public override bool Equals(object? obj)
Parameters
obj
objectThe object to compare with the current ActionGroupModuleBuilder.
Returns
- bool
true
if the specified ActionGroupModuleBuilder is equal to the current ActionGroupModuleBuilder; otherwise,false
.
Remarks
If the object passes is an ActionGroupModuleBuilder, Equals(ActionGroupModuleBuilder?) will be called to compare the 2 instances.
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
Operators
operator ==(ActionGroupModuleBuilder?, ActionGroupModuleBuilder?)
Determines whether the specified ActionGroupModuleBuilder is equal to the current ActionGroupModuleBuilder.
public static bool operator ==(ActionGroupModuleBuilder? left, ActionGroupModuleBuilder? right)
Parameters
left
ActionGroupModuleBuilderright
ActionGroupModuleBuilder
Returns
- bool
true
if the specified ActionGroupModuleBuilder is equal to the current ActionGroupModuleBuilder; otherwise,false
.
operator !=(ActionGroupModuleBuilder?, ActionGroupModuleBuilder?)
Determines whether the specified ActionGroupModuleBuilder is not equal to the current ActionGroupModuleBuilder.
public static bool operator !=(ActionGroupModuleBuilder? left, ActionGroupModuleBuilder? right)
Parameters
left
ActionGroupModuleBuilderright
ActionGroupModuleBuilder
Returns
- bool
true
if the specified ActionGroupModuleBuilder is not equal to the current ActionGroupModuleBuilder; otherwise,false
.