CommandRegistry class
Namespace: Arlecchino.Commands · Assembly: Arlecchino
The application commands registered with AddCommand. Take it in a view to list or run them yourself — the sample draws its menu straight from this.
public class CommandRegistry
Constructors
| Member | Summary |
|---|---|
CommandRegistry(IEnumerable<IArlecchinoCommand>) | Collects the registered commands. |
Properties
| Member | Summary |
|---|---|
Commands | The registered commands, in registration order. |
Methods
| Member | Summary |
|---|---|
Send(KeyPress) | Runs the command a key belongs to, if any. |
TryFind(KeyPress, out IArlecchinoCommand) | Finds the command a key press belongs to. |
Constructors in detail
CommandRegistry(IEnumerable<IArlecchinoCommand>)
public CommandRegistry(IEnumerable<IArlecchinoCommand> commands);
Collects the registered commands.
Parameters
| Name | Type | Description |
|---|---|---|
commands | IEnumerable<T><IArlecchinoCommand> | Commands from the container, in registration order. |
Properties in detail
Commands
public IReadOnlyList<IArlecchinoCommand> Commands { get; }
The registered commands, in registration order.
Type IReadOnlyList<T><IArlecchinoCommand>
Methods in detail
Send(KeyPress)
public ViewRoute Send(KeyPress press);
Runs the command a key belongs to, if any.
Parameters
| Name | Type | Description |
|---|---|---|
press | KeyPress | The key that was pressed. |
Returns ViewRoute — The route the command returned, or ViewRoute.None.
TryFind(KeyPress, out IArlecchinoCommand)
public bool TryFind(KeyPress press, out IArlecchinoCommand? command);
Finds the command a key press belongs to.
Parameters
| Name | Type | Description |
|---|---|---|
press | KeyPress | The key that was pressed. |
command | IArlecchinoCommand | The command, when one claims the key. |
Returns bool — true when a command claimed the key.