Skip to content

Commit a043028

Browse files
committed
update invoke
1 parent 898d5c0 commit a043028

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

hub/powertoys/command-palette/microsoft-commandpalette-extensions/iinvokablecommand_invoke.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: IInvokableCommand.Invoke(Object) Method
33
description:
4-
ms.date: 2/7/2025
4+
ms.date: 2/10/2025
55
ms.topic: reference
66
no-loc: [PowerToys, Windows, Insider]
77
---
@@ -16,13 +16,16 @@ The method called when a user selects a command.
1616

1717
## Parameters
1818

19-
`sender` Object
19+
**`sender`** Object
20+
2021
Represents the context of where the command was invoked from. This can be different types depending on where the command is being used:
2122

22-
- [TopLevelCommands](icommandprovider_toplevelcommands.md) (and fallbacks): `sender` is the [ICommandItem](icommanditem.md) for the top-level command that was invoked
23-
- [IListPage.GetItems()](ilistpage_getitems.md): `sender` is the [IListItem](ilistitem.md) for the list item selected for that command
24-
- [ICommandItem.MoreCommands](icommanditem.md) (context menus): `sender` is either the [IListItem](ilistitem.md) which the command was attached to for a list page or the [ICommandItem](icommanditem.md) of the top-level command (if this is a context item on a top-level command)
25-
- [IContentPage.Commands](icontentpage.md): `sender` is the [IContentPage](icontentpage.md) itself
23+
- [TopLevelCommands](icommandprovider_toplevelcommands.md) (and fallbacks): `sender` is the [ICommandItem](icommanditem.md) for the top-level command that was invoked.
24+
- [IListPage.GetItems()](ilistpage_getitems.md): `sender` is the [IListItem](ilistitem.md) for the list item selected for that command.
25+
- [ICommandItem.MoreCommands](icommanditem.md) (context menus): `sender` is either the [IListItem](ilistitem.md) which the command was attached to for a list page or the [ICommandItem](icommanditem.md) of the top-level command (if this is a context item on a top-level command).
26+
- [IContentPage.Commands](icontentpage.md): `sender` is the [IContentPage](icontentpage.md) itself.
27+
28+
Using the `sender` parameter can be useful for big lists of items where the actionable information for each item is somewhat the same. One example would be a long list of links. You can implement this as a single [IInvokableCommand](iinvokablecommand.md) that opens a URL based on the `sender` object passed in. Then, each list item would store the URL to open and the title of the link. This creates less overhead for the extension and host to communicate.
2629

2730
## Returns
2831

0 commit comments

Comments
 (0)