Partager via


AsyncUiTask<TBusinessObject> Constructor (String, AsyncAction<TBusinessObject>)

 

Initializes a new instance of the AsyncUiTask<TBusinessObject> class with the specified display name and the specified delegate method that performs the action of the task.

Namespace:   Microsoft.WindowsServerSolutions.Administration.ObjectModel
Assembly:  Microsoft.WindowsServerSolutions.Administration.ObjectModel (in Microsoft.WindowsServerSolutions.Administration.ObjectModel.dll)

Syntax

public AsyncUiTask(
    string displayName,
    AsyncAction<TBusinessObject> action
)
public:
AsyncUiTask(
    String^ displayName,
    AsyncAction<TBusinessObject>^ action
)
Public Sub New (
    displayName As String,
    action As AsyncAction(Of TBusinessObject)
)

Parameters

Remarks

The delegate method that is provided in the action parameter can receive an object from an Initializer<TBusinessObject> delegate method. An Initializer<TBusinessObject> delegate method is used to perform lengthy initialization processes that need to be completed before the task can be completed. For information about how to set an Initializer<TBusinessObject> delegate method, see Initialization.

TBusinessObject represents a business object that encapsulates information and methods that relate to business data or business functionality. The information in the business object is exposed as properties.

Examples

The following code example shows how to initialize an AsyncUiTask<TBusinessObject> object with an AsyncAction<TBusinessObject> delegate method and an Initializer<TBusinessObject> delegate method:

TaskCollection tasks = new TaskCollection();

AsyncUiTask<BusinessObject> aTask = null;
aTask = new AsyncUiTask<BusinessObject>("UI Task", BusinessAsyncAction);

aTask.Initialization = BusinessInitializer;
tasks.Add(aTask);

private static object BusinessAsyncAction(
    BusinessObject businessObject, object aTaskObject)
{
    // Perform task action using aTaskObject
    return newObject;
}

private static object BusinessInitializer(BusinessObject businessObject)
{
    // Perform lengthy initialization process using businessObject
    return aTaskObject
}

See Also

AsyncUiTask<TBusinessObject> Overload
AsyncUiTask<TBusinessObject> Class
Microsoft.WindowsServerSolutions.Administration.ObjectModel Namespace

Return to top