Skip to content

CommandArgs.Command

property · CommandArgs · cAlgo.API

DesktopCLICloud

Gets the command associated with these arguments.

Environment behaviour

CLI — not supported. Available to plugins only, and plugins cannot run in the CLI.

Cloud — not supported. Available to plugins only, and plugins cannot run in the cloud.

Definition

public Command Command {get;}
commandArgs.Command: Command

Returns Command

Examples

protected override void OnStart()
{
    Commands.Add(CommandType.ChartContainerToolbar, OnCommandExecuted);
}

private void OnCommandExecuted(CommandArgs args)
{
    args.Command.IsEnabled = false;
    Print("Command {0} disabled after first use", args.Command.Id);
}
from System import Action

def on_start(self):
    api.Commands.Add(CommandType.ChartContainerToolbar, Action[CommandArgs](self.on_command_executed))

def on_command_executed(self, args):
    args.Command.IsEnabled = False
    api.Print(f"Command {args.Command.Id} disabled after first use")