Working with the Task Framework


In this topic


About tasks and the Web ADF

Tasks are defined as a set of related actions that provide common results. The Web Application Developer Framework (ADF) provides a task framework to create, integrate, and distribute components, or Web tasks.

Web ADF TaskFramework

A Web task is an ASP.NET Web control that utilizes and extends the Web ADF task framework to encapsulate custom functionality in a distributable component. The framework includes the following:
  • Interfaces and abstract classes to create custom tasks
  • Controls to support task management and results
  • Pluggable architecture to integrate a custom task in Visual Studio or ArcGIS Manager (Manager)
In addition, a set of out-of-the-box task controls are included with the Web ADF to support common GIS functionality requirements in a Web application.
 

Interfaces and classes

The following diagram shows the interfaces and classes in the task framework:
The red items are part of the Web ADF task framework. The green items illustrate where you can customize the task framework and how it is related to existing framework components. The Task and FloatingPanelTask abstract classes implement the basic ITask interface. All interfaces can be used to create a custom task depending on the capabilities required by the task.
This is all that is required to create a custom task. However, to integrate with other Web ADF components, you can customize other task components. You can use
  • ITaskDesigner to customize the Visual Studio design-time verbs available on the custom task control.
  • IWebConfigurator interface defines how to integrate the custom task into the Manager application. This enables you to select the custom task from a list when creating a new Web application using Manager.
  • Use ITaskResultsContainer interface to define a custom container or control to display task results.
The core task interface is ITask in the ESRI.ArcGIS.ADF.Web.UI.WebControls namespace. At a basic level, a task must implement the ITask interface. The interface definition is shown in the following code:
[HTML]
namespace ESRI.ArcGIS.ADF.Web.UI.WebControls
{
    public interface ITask
    {
        string ShowUrl { get;}
        string Title { get; set;}
        string ToolTip { get;set;}
        string NavigationPath { get; set;}
        BuddyControlCollection TaskResultsContainers { get;}
        object Results { get;set;}
        void ExecuteTask();
        string TaskActivityIndicatorText { get;}
        bool GroupResultsByTable { get;set;}
        bool ShowFieldAttributes { get;set;}
        bool ShowLegend { get; set;}
        object Input { get; set;}
        void Refresh();
        void Show();
        CallbackResultCollection CallbackResults { get;}
        string UniqueID { get;}
        List<GISResourceItemDependency> GetGISResourceItemDependencies();
    }
}
The Task and FloatingPanelTask abstract classes handle most of the overhead associated with ITask implementation and can be extended. Use these classes to get started. The main difference between the two is a custom task that extends Task is not contained in FloatingPanel, but a custom task that extends FloatingPanelTask is contained in FloatingPanel at run time. See the following screen shot:
Tasks are essentially ASP.NET composite controls. As a result, both Task and FloatingPanelTask extend System.Web.UI.WebControls.CompositeControl. CompositeControl implements the ICallbackEventHandler interface, which enables a control to work with Asynchronous JavaScript and XML (AJAX) functionality in an ASP.NET Web application.
The IBuddyControlSupport interface defines a method to return the types of controls the custom task can buddy with. The Task and FloatingPanelTask classes define the controls of type ITaskResultsContainer that can be buddied with them, such as the TaskResults control.

Task support controls

The following task support controls enhance the Web task run time experience. Their use is optional.
  • TaskManager —The TaskManager control organizes tasks in a Web application. The TaskManager control generates hierarchical Extensible Markup Language (XML) data that can be used by an ASP.NET navigation control such as Menu or TreeView. At run time, nodes in the ASP.NET Menu or TreeView can be used to display the floating panel for a task. The TaskManager control is only visible at design time.
  • TaskResults —The TaskResults control stores the results of tasks that produce ADO.NET DataSet output. The results are presented as nodes in TreeView. You can also use the TaskResults control to zoom or pan to a feature, highlight a feature in a result set, re-run a task, or remove task results.

Out-of-the-box task controls

All task controls implement and extend the task framework to be fully integrated with Web ADF application creation capabilities and development environments. The controls include the following:
  • SearchAttributesTask —The SearchAttributesTask control enables you to select a set of fields, provided by resources, in which to search for the occurrence of a user-provided value. At run time, each field is queried for the occurrence of a user-provided value. Partial values are permitted. Only feature layers in resources provided by MapResourceManager can be used. The results are provided as an ADO.NET DataSet to be displayed in a TaskResults control.
  • QueryAttributesTask —The QueryAttributesTask control enables you to explicitly define the parameters used to query values in a field. This control enhances the basic query capability of SearchAttributesTask. At run time, the QueryAttributesTask query can provide a drop-down list of preset choices or a text box for general text entry. Each query can use a validator to restrict the values entered. In addition, multiple queries can be grouped together to produce a single result. Only feature layers in resources provided by MapResourceManager can be used. The results are provided as an ADO.NET DataSet to be displayed in a TaskResults control.  
  • FindAddressTask —The FindAddressTask control utilizes resources in GeocodeResourceManager to perform geocode operations. The control interface is created dynamically at run time, based on the inputs required by the geocode resource it will use. The results (match or address candidates) are provided as an ADO.NET DataSet to be displayed in a TaskResults control.
  • GeoprocessingTask —The GeoprocessingTask control uses resources in GeoprocessingResourceManager to execute geoprocessing tasks. The control interface is created dynamically at run time, based on the inputs required by the geoprocessing resource and the task it will use. The results, which include input and output parameters as well as progress messages, are provided as an ADO.NET DataSet to be displayed in a TaskResults control.
  • EditorTask —The EditorTask control provides a suite of tools for Web-based editing of features in both versioned and non-versioned enterprise geodatabases. If configured, specific versions can be selected for editing. The run time dialog provides tools to modify, add, and remove feature geometry and attributes.
  • PrintTask —The PrintTask control provides run time print capabilities to a Web ADF application. It enables you to print a map and task results, along with a legend, scale bar, copyright, and north arrow.

UserControlTask Control

The UserControlTask control enables you to integrate an ASP.NET User control as a task within an ADF application. The Web ADF task framework includes a base class, ESRI.ArcGIS.ADF.Web.UI.WebControls.UserControlTaskPanel, you can subclass in an ASP.NET User control to gain access to task framework behavior and capabilities.
It is easy to use and gives a real design-time experience to the developers.
The UserControlTask only works with the ASP.NET Asynchronous JavaScript and XML (AJAX) partial postback pattern for asynchronous communication in a Web application. 
A ScriptManager must be on the page for the UserControlTask to function.


See Also:

Creating a custom server task
Creating a custom UserControlTask