Table of Contents

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
object
Commands

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

id string

Local id (no namespace prefix); host prepends plugin name.

title string

Display name shown in the command palette.

handler Action

Action to run when the command is invoked.

inRebindList bool

If 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.

inPalette bool

If 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.