(by Rob Dunfey, ArcGIS Explorer SDK Development Team)
Custom tasks have many different functions, but for all their differences they have much in common. For example, all custom tasks have a task lifecycle, and as a custom task developer it is important you are aware of what this means, and what it means to your task users.
As a task moves through its lifecycle, its status changes. At any given time a custom task has a status equal to one of six values, as listed in the esriE2TaskStatus enumeration illustrated below.
The current status of a task is displayed in the ArcGIS Explorer results panel when a custom task is pending execution, executing, or has been stopped. A custom task has default messages associated with each status value in the esriE2TaskStatus enumeration.
As a custom task developer you have full control over these messages, and are encouraged to set the message associated with a task status to give appropriate user feedback. For example, the default status message when a task is executing is ‘MyCustomTaskName – executing’ as illustrated below:
Using TaskContext.SetStatusMessage we can change the message associated with the Task executing status:
Having set the status message with the above code, the following is displayed when the task executes:
This message provides more feedback to the user, and is another facet of creating a well-implemented task.
For a comprehensive introduction to the lifecycle of a custom task, view the ArcGIS Explorer TaskContext Lifecycle Diagram which can be found at the ESRI Developer Network (EDN) site as well as in the Explorer SDK Help when you install it.
This is just one of several design patterns you can adopt when developing custom tasks to give your task a familiar look and feel. More tips and tricks can be found in the new ArcGIS Explorer Custom Task Style Guide.