WorkflowCreationContext.OnBeginWorkflowCompleted Methode

Definition

Startet einen asynchronen Vorgang zum Ausführen einer Benachrichtigung über den Abschluss der Workflowinstanz. Diese Methode wird aufgerufen, wenn die workflowinstanz, die dieser WorkflowCreationContext Methode zugeordnet ist, abgeschlossen ist. Abgeleitete Klassen können diesen Vorgang außer Kraft setzen, um benutzerdefinierte Aktionen für den Abschluss der Workflowinstanz auszuführen.

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

Parameter

completionState
ActivityInstanceState

Der Status der Workflowinstanz.

workflowOutputs
IDictionary<String,Object>

Eine Sammlung von Schlüssel-Wert-Paaren, die die von der Workflowinstanz generierte Ausgabe enthalten.

terminationException
Exception

Wenn vorhanden, ist ein Fehler aufgetreten, der dazu führte, dass der Workflow beendet wurde.

timeout
TimeSpan

Das Zeitintervall, in dem der asynchrone Vorgang abgeschlossen werden muss.

callback
AsyncCallback

Der Speicherort in einer Anwendung, an die das Steuerelement zurückgibt, wenn der asynchrone Vorgang abgeschlossen ist.

state
Object

Benutzerdefinierter Zustand.

Gibt zurück

Der Status des asynchronen Vorgangs.

Beispiele

Das folgende Beispiel zeigt, wie die OnBeginWorkflowCompleted Methode implementiert wird.

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);
}

Gilt für: