WorkflowEventArgs 클래스

정의

주의

The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*

워크플로 이벤트에 대한 데이터를 제공합니다.

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

예제

다음 코드 예제에서는 이벤트 처리기 메서드를 호출할 때 WorkflowInstance 속성을 사용하여 WorkflowInstance 개체를 가져오는 방법을 보여 줍니다. WorkflowIdled 이벤트가 발생하면 이 예제에서 정의된 OnWorkflowIdled 메서드가 호출됩니다. WorkflowInstance 속성을 사용하여 유휴 상태인 워크플로를 확인한 다음 GetWorkflowQueueData 메서드를 호출하여 워크플로 인스턴스에 대해 큐 항목 컬렉션을 가져옵니다. 이 코드는 컬렉션을 반복하여 워크플로를 유휴 상태로 만든 이벤트를 기다리고 있는 활동을 확인합니다. 그런 다음 이벤트 큐 항목의 이름과 함께 EnqueueItem 메서드를 사용하여 워크플로 큐에 예외를 보냅니다.

이 코드 예제는 Program.cs 파일에 있는 Canceling a Workflow SDK 샘플의 일부입니다. 자세한 내용은 워크플로 취소 하면합니다.

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

설명

참고

이 자료에서는 더 이상 사용되지 않는 형식과 네임스페이스에 대해 설명합니다. 자세한 내용은 Deprecated Types in Windows Workflow Foundation 4.5(Windows Workflow Foundation 4.5에서 사용되지 않는 형식)를 참조하세요.

워크플로 이벤트는 워크플로 인스턴스와 연결됩니다. WorkflowEventArgs는 워크플로 이벤트와 연결된 WorkflowInstance를 포함합니다. WorkflowEventArgs 또는 WorkflowEventArgs 클래스에서 파생된 개체는 WorkflowRuntime 클래스의 모든 워크플로 이벤트에 대한 데이터를 제공합니다. WorkflowEventArgsWorkflowCompletedEventArgs, WorkflowSuspendedEventArgsWorkflowTerminatedEventArgs의 기본 클래스입니다.

속성

WorkflowInstance
사용되지 않음.

워크플로 이벤트와 연결된 워크플로 인스턴스를 가져옵니다.

메서드

Equals(Object)
사용되지 않음.

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()
사용되지 않음.

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetType()
사용되지 않음.

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()
사용되지 않음.

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()
사용되지 않음.

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

적용 대상

추가 정보