Class Commands
- Namespace
- Ofs
- Assembly
- Ofs.Api.dll
Command registration. Handlers are supplied inline — there is no central dispatch switch. Call Register(string, string, Action, bool, bool) from OnLoad.
public sealed class Commands
- Inheritance
-
objectCommands
Methods
Register(string, string, Action, bool, bool)
Registers a palette command. Call from OnLoad.
public void Register(string id, string title, Action handler, bool inRebindList = false, bool inPalette = true)
Parameters
idstringLocal id (no namespace prefix); host prepends plugin name.
titlestringDisplay name shown in the command palette.
handlerActionAction to run when the command is invoked.
inRebindListboolIf true, the command is offered for binding in the Shortcut window by default. Defaults to false (palette-only) — a user can still opt in to bind a palette-only command.
inPaletteboolIf true, the command is searchable in the command palette.
Remarks
To localize the title, build it from your own catalog at OnLoad (e.g. Str.MyCommand):
the host reloads every plugin on a UI-language switch, so OnLoad re-runs and re-registers it.
Exceptions
- ArgumentException
Thrown if the command is listed on neither surface (rebind UI nor palette) — the user could never discover it to bind or invoke.