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.
Definition
Namespace: Microsoft.CommandPalette.Extensions.Toolkit
Indicates what the Command Palette should do after a command is executed. This allows commands to control the flow of the palette.
Implements ICommandResult
The CommandResult class is used to specify the result of a command execution in the Command Palette. It provides various methods to control the behavior of the Command Palette after a command is executed. This class is useful for managing navigation, displaying messages, and controlling the state of the Command Palette.
Properties
Property | Type | Description |
---|---|---|
Args | ICommandResultArgs | Gets or sets the arguments associated with the command result. This can include additional data needed for the command result. |
Kind | CommandResultKind | Gets or sets the result of the command. Defaults to CommandResultKind.Dismiss. |
Methods
Method | Description |
---|---|
Confirm(ConfirmationArgs) | Display a confirmation dialog to the user. |
Dismiss() | Close the Command Palette after the action is executed and dismiss the current state. On the next launch, the Command Palette will start from the main page with a blank query. |
GoBack() | Navigate to the previous page, and keep it open. |
GoHome() | Navigate back to the main page of the Command Palette and keep it open. This clears out the current stack of pages, but keeps the palette open. |
GoToPage(GoToPageArgs) | Navigate to a different page in the palette. The GoToPageArgs will specify which page to navigate to. |
Hide() | Creates a new CommandResult instance with Kind set to CommandResultKind.Hide and Args set to null . |
KeepOpen() | Do nothing. This leaves the palette in its current state, with the current page stack and query. |
ShowToast(String) | Display a transient desktop-level message to the user. Creates a new CommandResult with Args set to a new ToastArgs object with its Message set to String. |
ShowToast(ToastArgs) | Display a transient desktop-level message to the user. Creates a new CommandResult instance with Args set to ToastArgs. |
Example
See Command Results for an example of how to use this.
Windows developer