Table of Contents

Method CreateRunCommand

Namespace
OpenCAD2D
Assembly
OpenCAD2D.Core.dll

CreateRunCommand(string, bool, string, Action<CadRemoteToolRun>)

Makes the command of a tool, to put in the app's registry under the name the user types. The command is the run: it begins an undo step named after it, calls started so that the app can tell the tool, and then waits at NAME is working... (Esc to stop) while the tool asks its questions, commits and ends it (ask, commit, end, fail of the channel). The step is kept when the tool ends it well and taken back when it fails or Esc ends it, and the drawing is busy for every other command until then.

public CadCommand CreateRunCommand(string name, bool usesSelection, string token, Action<CadRemoteToolRun> started)

Parameters

name string

The name typed to run it, as CadCommand takes it.

usesSelection bool

Whether the objects selected before the command are taken by its first selection question, as MOVE takes them.

token string

The token of the tool process that does the work: only a connection with it may name the run.

started Action<CadRemoteToolRun>

Called on the thread of the drawings as the command begins, with the run; null for nothing. It must not wait for the tool.

Returns

CadCommand

The command.

Exceptions

ArgumentNullException

Thrown when the name or the token is null.

ArgumentException

Thrown when the name is not one word.

InvalidOperationException

Thrown on the app's own server, which has no runs.