Skip to main content

Implement handler by script

Overview

It implements the commands and events defined as extension points in the manifest. The functions implementing these processes are called command handlersandevent handlers. Implement those handlers in script files that you specify as entry points in your manifest.

Implementation example

Here's an example command handler implementation for the following commands defined in the manifest:

Manifest command definition example

manifest.json
  "extensionPoints": {
"commands": [
{
"id": "Command.SayHello",
"execFunc": "SayHello"
}
],
...
}

In the above command definition example, implement the command handler named SayHello specified in the extensionPoints.commands[0].execFunc property as a public function in the entry point script file.

Example of implementing a command handler in a script file

main.cs
//command handler
public void SayHello(ICommandContext context,ICommandParams commandParams)
{
App.Window.UI.ShowInformationDialog("Hello !","Hello World");
}
  • See global objects for more information about global objects available to scripts.

For more information on arguments passed to command handlers, see the following references:

important
  • Handlers must be implemented as public functions.
  • All handlers must be implemented in the script file specified in the entrypoint.