Interface ICommandManager
- Namespace
- Whim
- Assembly
- Whim.dll
ICommandManager is responsible for managing all the commands for Whim.
public interface ICommandManager : IEnumerable<ICommand>, IEnumerable
- Inherited Members
Fields
CustomCommandPrefix
The prefix for all custom commands.
public const string CustomCommandPrefix = "whim.custom"
Field Value
Properties
Count
Gets the number of commands in the manager.
int Count { get; }
Property Value
Methods
Add(string, string, Action, Func<bool>?)
Adds a new user-defined command to the manager.
void Add(string identifier, string title, Action callback, Func<bool>? condition = null)
Parameters
identifierstring- The identifier of the command. This will be prefixed with
whim.custom.This must be unique. titlestring- The title of the command.
callbackAction- The callback to execute. This can include triggering a menu to be shown by Whim.CommandPalette, or to perform some other action.
conditionFunc<bool>- A condition to determine if the command should be visible, or able to be executed. If this is null, the command will always be accessible.
TryGetCommand(string)
Tries to get the command with the given identifier.
ICommand? TryGetCommand(string commandId)
Parameters
commandIdstring- The identifier of the command to get
Returns
- ICommand
- The command with the given identifier, or null if not found.