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
namestringThe name typed to run it, as CadCommand takes it.
usesSelectionboolWhether the objects selected before the command are taken by its first
selectionquestion, as MOVE takes them.tokenstringThe token of the tool process that does the work: only a connection with it may name the run.
startedAction<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.