Skip to main content

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

MemberSummary
CommandRegistry(IEnumerable<IArlecchinoCommand>)Collects the registered commands.

Properties

MemberSummary
CommandsThe registered commands, in registration order.

Methods

MemberSummary
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

NameTypeDescription
commandsIEnumerable<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

NameTypeDescription
pressKeyPressThe 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

NameTypeDescription
pressKeyPressThe key that was pressed.
commandIArlecchinoCommandThe command, when one claims the key.

Returns booltrue when a command claimed the key.