WorkflowEventArgs 클래스

정의

경고

이 API는 현재 사용되지 않습니다.

워크플로 이벤트에 대한 데이터를 제공합니다.Provides data for workflow events.

public ref class WorkflowEventArgs : EventArgs
[System.Obsolete("The System.Workflow.* types are deprecated.  Instead, please use the new types from System.Activities.*")]
public class WorkflowEventArgs : EventArgs
type WorkflowEventArgs = class
    inherit EventArgs
Public Class WorkflowEventArgs
Inherits EventArgs
상속
WorkflowEventArgs
파생
특성

예제

다음 코드 예제에서는 이벤트 처리기 메서드를 호출할 때 WorkflowInstance 속성을 사용하여 WorkflowInstance 개체를 가져오는 방법을 보여 줍니다.The following code example demonstrates how to obtain a WorkflowInstance object using the WorkflowInstance property when an event handler method is called. WorkflowIdled 이벤트가 발생하면 이 예제에서 정의된 OnWorkflowIdled 메서드가 호출됩니다.When the WorkflowIdled event occurs, the OnWorkflowIdled method defined in this example is called. WorkflowInstance 속성을 사용하여 유휴 상태인 워크플로를 확인한 다음 GetWorkflowQueueData 메서드를 호출하여 워크플로 인스턴스에 대해 큐 항목 컬렉션을 가져옵니다.It determines which workflow is idled using the WorkflowInstance property and then gets a collection of queued items for the workflow instance by calling the GetWorkflowQueueData method. 이 코드는 컬렉션을 반복하여 워크플로를 유휴 상태로 만든 이벤트를 기다리고 있는 활동을 확인합니다.The code iterates over the collection to determine which activity is waiting for the event that idled the workflow. 그런 다음 이벤트 큐 항목의 이름과 함께 EnqueueItem 메서드를 사용하여 워크플로 큐에 예외를 보냅니다.It then sends an exception to the workflow queue using the EnqueueItem method along with the name of the event queue item.

이 코드 예제는 Program.cs 파일에 있는 Canceling a Workflow SDK 샘플의 일부입니다.This code example is part of the Canceling a Workflow SDK Sample from the Program.cs file. 자세한 내용은 워크플로 취소 하면합니다.For more information, see Canceling a Workflow.

static void OnWorkflowIdled(object sender, WorkflowEventArgs e)
{
    WorkflowInstance workflow = e.WorkflowInstance;

    Console.WriteLine("\n...waiting for 3 seconds... \n");
    Thread.Sleep(3000);

    // what activity is blocking the workflow
    ReadOnlyCollection<WorkflowQueueInfo> wqi = workflow.GetWorkflowQueueData();
    foreach (WorkflowQueueInfo q in wqi)
    {
        EventQueueName eq = q.QueueName as EventQueueName;
        if (eq != null)
        {
            // get activity that is waiting for event
            ReadOnlyCollection<string> blockedActivity = q.SubscribedActivityNames;
            Console.WriteLine("Host: Workflow is blocked on " + blockedActivity[0]);

            // this event is never going to arrive eg. employee left the company
            // lets send an exception to this queue
            // it will either be handled by exception handler that was modeled in workflow
            // or the runtime will unwind running compensation handlers and exit the workflow
            Console.WriteLine("Host: This event is not going to arrive");
            Console.WriteLine("Host: Cancel workflow with unhandled exception");
            workflow.EnqueueItem(q.QueueName, new Exception("ExitWorkflowException"), null, null);
        }
    }
}
Shared Sub OnWorkflowIdled(ByVal sender As Object, ByVal e As WorkflowEventArgs)
    Dim workflow As WorkflowInstance = e.WorkflowInstance

    Console.WriteLine(vbCrLf + "...waiting for 3 seconds... " + vbCrLf)
    Thread.Sleep(3000)

    ' what activity is blocking the workflow
    Dim wqi As ReadOnlyCollection(Of WorkflowQueueInfo) = workflow.GetWorkflowQueueData()
    For Each q As WorkflowQueueInfo In wqi

        Dim eq As EventQueueName = TryCast(q.QueueName, EventQueueName)

        If eq IsNot Nothing Then
            ' get activity that is waiting for event
            Dim blockedActivity As ReadOnlyCollection(Of String) = q.SubscribedActivityNames
            Console.WriteLine("Host: Workflow is blocked on " + blockedActivity(0))

            ' this event is never going to arrive eg. employee left the company
            ' lets send an exception to this queue
            ' it will either be handled by exception handler that was modeled in workflow
            ' or the runtime will unwind running compensation handlers and exit the workflow
            Console.WriteLine("Host: This event is not going to arrive")
            Console.WriteLine("Host: Cancel workflow with unhandled exception")
            workflow.EnqueueItem(q.QueueName, New Exception("ExitWorkflowException"), Nothing, Nothing)
        End If
    Next
End Sub

설명

참고

이 자료에서는 더 이상 사용되지 않는 형식과 네임스페이스에 대해 설명합니다.This material discusses types and namespaces that are obsolete. 자세한 내용은 Deprecated Types in Windows Workflow Foundation 4.5(Windows Workflow Foundation 4.5에서 사용되지 않는 형식)를 참조하세요.For more information, see Deprecated Types in Windows Workflow Foundation 4.5.

워크플로 이벤트는 워크플로 인스턴스와 연결됩니다.Workflow events are associated with a workflow instance. WorkflowEventArgs는 워크플로 이벤트와 연결된 WorkflowInstance를 포함합니다.A WorkflowEventArgs contains the WorkflowInstance associated with the workflow event. WorkflowEventArgs 또는 WorkflowEventArgs 클래스에서 파생된 개체는 WorkflowRuntime 클래스의 모든 워크플로 이벤트에 대한 데이터를 제공합니다.A WorkflowEventArgs or an object that derives from the WorkflowEventArgs class provides the data for all of the workflow events in the WorkflowRuntime class. WorkflowEventArgsWorkflowCompletedEventArgs, WorkflowSuspendedEventArgsWorkflowTerminatedEventArgs의 기본 클래스입니다.WorkflowEventArgs is the base class for WorkflowCompletedEventArgs, WorkflowSuspendedEventArgs, and WorkflowTerminatedEventArgs.

속성

WorkflowInstance

워크플로 이벤트와 연결된 워크플로 인스턴스를 가져옵니다.Gets the workflow instance associated with the workflow event.

메서드

Equals(Object)

지정한 개체와 현재 개체가 같은지 여부를 확인합니다.Determines whether the specified object is equal to the current object.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.Serves as the default hash function.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.Gets 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)

적용 대상

추가 정보