Table of Contents

Method InvokeCommand

Namespace
Terminal.Gui.ViewBase
Assembly
Terminal.Gui.dll

InvokeCommand(Command, ICommandBinding?)

Invokes the specified command given a binding. The binding is used as context for the command invocation and can be used by command handlers to make decisions based on the source of the command.

public bool? InvokeCommand(Command command, ICommandBinding? binding)

Parameters

command Command

The command to invoke.

binding ICommandBinding

The binding that caused the invocation, if any. This will be passed as context with the command.

Returns

bool?

null if no command was found; input processing should continue. false if the command was invoked and was not handled (or cancelled); input processing should continue. true if the command was invoked the command was handled (or cancelled); input processing should stop.

InvokeCommand(Command, ICommandContext?)

Invokes the specified command given a context. This is the most general form of InvokeCommand and allows the caller to specify arbitrary context.

public bool? InvokeCommand(Command command, ICommandContext? ctx)

Parameters

command Command

The command to invoke.

ctx ICommandContext

The context to pass with the command.

Returns

bool?

null if no command was found; input processing should continue. false if the command was invoked and was not handled (or cancelled); input processing should continue. true if the command was invoked the command was handled (or cancelled); input processing should stop.

InvokeCommand(Command)

Invokes the specified command with a default CommandContext where Source is a weak reference to this. The binding in the context will be set to null since this method is for invocations that are not caused by a binding (e.g. bubbling, default button invocation, etc.).

public bool? InvokeCommand(Command command)

Parameters

command Command

The command to invoke.

Returns

bool?

null if no command was found; input processing should continue. false if the command was invoked and was not handled (or cancelled); input processing should continue. true if the command was invoked the command was handled (or cancelled); input processing should stop.