Table of Contents

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

string

Properties

Count

Gets the number of commands in the manager.
int Count { get; }

Property Value

int

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

identifier string
The identifier of the command. This will be prefixed with whim.custom. This must be unique.
title string
The title of the command.
callback Action
The callback to execute. This can include triggering a menu to be shown by Whim.CommandPalette, or to perform some other action.
condition Func<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

commandId string
The identifier of the command to get

Returns

ICommand
The command with the given identifier, or null if not found.