WorkflowApplicationCompletedEventArgs 類別

定義

提供已完成執行作業之工作流程執行個體的相關資訊。Provides information about a workflow instance that has completed its execution.

public ref class WorkflowApplicationCompletedEventArgs : System::Activities::WorkflowApplicationEventArgs
public class WorkflowApplicationCompletedEventArgs : System.Activities.WorkflowApplicationEventArgs
type WorkflowApplicationCompletedEventArgs = class
    inherit WorkflowApplicationEventArgs
Public Class WorkflowApplicationCompletedEventArgs
Inherits WorkflowApplicationEventArgs
繼承
WorkflowApplicationCompletedEventArgs

範例

下列程式碼範例會檢查傳遞給 WorkflowApplicationCompletedEventArgs 執行個體之 Completed 處理常式的 WorkflowApplication,並且顯示工作流程如何完成的相關資訊。The following code example inspects the WorkflowApplicationCompletedEventArgs passed into the Completed handler of a WorkflowApplication instance and displays information about how the workflow completed.

wfApp.Completed = delegate(WorkflowApplicationCompletedEventArgs e)
{
    if (e.CompletionState == ActivityInstanceState.Faulted)
    {
        Console.WriteLine("Workflow {0} Terminated.", e.InstanceId);
        Console.WriteLine("Exception: {0}\n{1}",
            e.TerminationException.GetType().FullName,
            e.TerminationException.Message);
    }
    else if (e.CompletionState == ActivityInstanceState.Canceled)
    {
        Console.WriteLine("Workflow {0} Canceled.", e.InstanceId);
    }
    else
    {
        Console.WriteLine("Workflow {0} Completed.", e.InstanceId);

        // Retrieve the outputs of the workflow.
        foreach (var kvp in e.Outputs)
        {
            Console.WriteLine("Name: {0} - Value {1}",
                kvp.Key, kvp.Value);
        }

        // Outputs can be directly accessed by argument name.
        Console.WriteLine("The winner is {0}.", e.Outputs["Winner"]);
    }
};

屬性

CompletionState

取得工作流程執行個體的完成狀態,這個完成狀態會表示工作流程執行個體是否已成功完成、已取消或是發生錯誤的狀態。Gets the completion state of the workflow instance, which indicates whether the workflow instance completed successfully, was canceled, or faulted.

InstanceId

工作流程執行個體的唯一識別碼。The unique identifier of the workflow instance.

(繼承來源 WorkflowApplicationEventArgs)
Outputs

取得包含 OutArgument 之工作流程執行個體根活動的值,以引數名稱作為索引鍵。Gets a dictionary that contains the values of OutArguments of the workflow instance's root activity, keyed by argument name.

TerminationException

取得與工作流程執行個體終止相關聯的例外狀況。Gets the exception associated with the termination of the workflow instance.

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(繼承來源 Object)
GetInstanceExtensions<T>()

取得指定之型別的延伸集合。Gets the collection of extensions of the specified type.

(繼承來源 WorkflowApplicationEventArgs)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)

適用於