Scriptable Commands can be created to allow interaction through JavaScript. All command must implement the interface
IScriptableCommand or inherit from abstract classes ScriptableCommand or ScriptableCommand
. Here's a fully implemented scriptableCommand example: DrawCommand.
IScriptableCommand Interface ¶
Methods
Name | Return Type | Description |
---|
CanRespondToCommand(string command) | bool | This method is implemented to return if the command can respond to command name |
Execute(string parameter) | void | The method that executes when the JavaScript ExecuteCommand is run. |
Initialize(IDictionary customSettings) | void | This method is called when the application is initially loaded. This can be used to take in custom configuration for a particular command. |
Properties
Name | Type | Description |
---|
CommandVerb | string | The command verb that is passed into the executeCommand method to execute this command. |
Executing | bool | Lets the framework know if the command is currently executing |
IsInitialized | bool | Lets the framework know if the command has been initialized and is available to be called. |
Events
Name | Type | Description |
---|
ExecutionComplete | EventHandler | This should be raised when execution is complete. |
CommandExecutionCompleteEventArgs¶
Name | Type | Description |
---|
Message | string | A message that can be returned back to the JavaScript caller. |
Result | object | A result object that can be returned back to the JavaScript caller. |
Success | bool | Returns to the JavaScript caller if the call was a sucess or not. |
ScriptableCommand Class¶
Two abstract classes are provided to allow easier implementations of ScriptableCommands. The two classes are ScriptableCommand and ScriptableCommand, the class ScriptableCommand is used to pass Type T parameters into the command.
Abstract Members
These members need to be implemented from the abstract class.
Class | Name | Member Type | Type | Description |
---|
ScriptableCommand/ScriptableCommand | CommandVerb | Property | string | The CommandVerb that is passed into ExecuteCommand to specify the command used. |
ScriptableCommand | OnExecute(string parameter) | Method | void | This method is implemented with the logic you want execute when the command is run. |
ScriptableCommand | Execute(T parameters) | Method | void | This method is implemented with the logic you want execute when the command is run. |
Methods
Name | Return Type | Description |
---|
CanRespondToCommand(string command) | bool | Returns true if the string matches the CommandVerb. The match is case insensitive. |
ClearGraphics() | void | Clears all graphics from the current graphics manager. |
Dispose() | void | Clears all graphics from the current graphics manager. |
Execute(string parameter) | void | Executes the command with the specified parameter. |
Failure(Exception ex) | void | Called when a failure occurs and relays this back to JavaScript. |
Initialize(IDictionary customSettings) | void | Initialize the command with the provided settings. |
OnInitialize(IDictionary customSettings) | void | A virtual method that allows code to be executed on initialization. |
Success(object result) | void | Called when the command is a success and relays this back to JavaScript. |
Properties
Name | Type | Description |
---|
Executing | bool | Returns true if the command is currently executing. |
GraphicsManager | GraphicsManager | A graphicsManager that allows the manipulation of graphics on the map. |
IsInitialized | bool | Returns true if the command has been initialized. |
See Also