Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
CommandItem() Constructor
Definition
Namespace: Microsoft.CommandPalette.Extensions.Toolkit
Initializes a new instance of the CommandItem class.
public CommandItem()
: this(new NoOpCommand())
{
}
CommandItem(ICommand) Constructor
Definition
Namespace: Microsoft.CommandPalette.Extensions.Toolkit
Initializes a new instance of the CommandItem class, setting its Command property to command and its Title to the command's Name.
public CommandItem(ICommand command)
{
Command = command;
Title = command.Name;
}
Parameters
command ICommand
The command associated with the command item. This property allows access to the command's logic and execution behavior.
CommandItem(ICommandItem) Constructor
Definition
Namespace: Microsoft.CommandPalette.Extensions.Toolkit
Initializes a new instance of the CommandItem class, setting its Command property to other's Command, its Title to other's Title, its Subtitle to other's Subtitle, its Icon to other's Icon, and its MoreCommands to other's MoreCommands.
public CommandItem(ICommandItem other)
{
Command = other.Command;
Title = other.Title;
Subtitle = other.Subtitle;
Icon = (IconInfo?)other.Icon;
MoreCommands = other.MoreCommands;
}
Parameters
other ICommandItem
The command item to copy. This parameter is used to initialize the new command item with the properties of an existing command item.
CommandItem(String, String, String, Action, ICommandResult) Constructor
Definition
Namespace: Microsoft.CommandPalette.Extensions.Toolkit
Initializes a new instance of the CommandItem class, setting its Title property to title, its Subtitle to subtitle, and creates a new AnonymousCommand object with a name, action, and result.
public CommandItem(
string title,
string subtitle = "",
string name = "",
Action? action = null,
ICommandResult? result = null)
{
var c = new AnonymousCommand(action);
if (!string.IsNullOrEmpty(name))
{
c.Name = name;
}
if (result != null)
{
c.Result = result;
}
Command = c;
Title = title;
Subtitle = subtitle;
}
Parameters
title String
The title of the command item. This property represents the primary label or name of the command, displayed in the command palette.
subtitle String
The subtitle of the command item. This property provides additional context or information about the command, enhancing the user experience.
name String
The name of the command. This property is used to identify the command within the command palette.
action Action
The action to be performed when the command is executed. This property defines the logic or behavior associated with the command.
result ICommandResult
The result of the command execution. This property provides information about the outcome of the command, such as success or failure, and any relevant data returned by the command.
Windows developer