Editar

Compartir a través de


WorkflowCreationContext.OnBeginWorkflowCompleted Method

Definition

Begins an asynchronous operation to perform workflow instance completion notification. This method is called when the workflow instance associated with this WorkflowCreationContext completes. Derived classes can override this operation to perform custom actions on workflow instance completion.

protected public:
 virtual IAsyncResult ^ OnBeginWorkflowCompleted(System::Activities::ActivityInstanceState completionState, System::Collections::Generic::IDictionary<System::String ^, System::Object ^> ^ workflowOutputs, Exception ^ terminationException, TimeSpan timeout, AsyncCallback ^ callback, System::Object ^ state);
protected internal virtual IAsyncResult OnBeginWorkflowCompleted (System.Activities.ActivityInstanceState completionState, System.Collections.Generic.IDictionary<string,object> workflowOutputs, Exception terminationException, TimeSpan timeout, AsyncCallback callback, object state);
abstract member OnBeginWorkflowCompleted : System.Activities.ActivityInstanceState * System.Collections.Generic.IDictionary<string, obj> * Exception * TimeSpan * AsyncCallback * obj -> IAsyncResult
override this.OnBeginWorkflowCompleted : System.Activities.ActivityInstanceState * System.Collections.Generic.IDictionary<string, obj> * Exception * TimeSpan * AsyncCallback * obj -> IAsyncResult
Protected Friend Overridable Function OnBeginWorkflowCompleted (completionState As ActivityInstanceState, workflowOutputs As IDictionary(Of String, Object), terminationException As Exception, timeout As TimeSpan, callback As AsyncCallback, state As Object) As IAsyncResult

Parameters

completionState
ActivityInstanceState

The state of the workflow instance.

workflowOutputs
IDictionary<String,Object>

A collection of key/value pairs that contain output generated by the workflow instance.

terminationException
Exception

If present, an error that caused the workflow to terminate.

timeout
TimeSpan

The time interval during which the asynchronous operation must complete.

callback
AsyncCallback

The location in an application to which control returns when the asynchronous operation completes.

state
Object

User-defined state.

Returns

The status of the asynchronous operation.

Examples

The following example shows how to implement the OnBeginWorkflowCompleted method.

protected override IAsyncResult OnBeginWorkflowCompleted(ActivityInstanceState completionState, IDictionary<string, object> workflowOutputs,
    Exception faultedReason, TimeSpan timeout, AsyncCallback callback, object state)
{
    if (completionState == ActivityInstanceState.Faulted)
    {
        Console.WriteLine("InstanceId :" + InstanceId + " OnBeginWorkflowTerminated");
    }
    else if (completionState == ActivityInstanceState.Canceled)
    {
        Console.WriteLine("InstanceId :" + InstanceId + " OnBeginWorkflowCanceled");
    }
    else
    {
        Console.WriteLine("InstanceId :" + InstanceId + " OnBeginWorkflowCompleted");
        WorkflowHostingResponseContext responseContext = UserState as WorkflowHostingResponseContext;
        if (responseContext != null)
        {
            foreach (object value in workflowOutputs.Values)
            {
                responseContext.SendResponse(value, null);
                break;
            }
        }
    }
    return base.OnBeginWorkflowCompleted(completionState, workflowOutputs, faultedReason, timeout, callback, state);
}

Applies to