Skip to content

CommandResult

class cAlgo.API

DesktopCLICloud

Represents the result of a command execution.

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 class CommandResult

Namespace: cAlgo.API · Group: Commands

Examples

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

private CommandResult OnCommandExecuted(CommandArgs args)
{
    var panel = new StackPanel();
    panel.AddChild(new TextBlock { Text = $"Open positions: {Positions.Count}" });
    return new CommandResult(panel);
}
from System import Func

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

def on_command_executed(self, args):
    textBlock = TextBlock()
    textBlock.Text = f"Open positions: {api.Positions.Count}"
    panel = StackPanel()
    panel.AddChild(textBlock)
    return CommandResult(panel)

Constructors

Name Description
CommandResultDesktopCLICloud Initialises a new instance of the CommandResult class.

Properties

Name Description
ChildDesktopCLICloudControlBase Gets the child control associated with the command result.

See also