WorkflowEventArgs Sınıf

Tanım

Dikkat

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

İş akışı olayları için veri sağlar.

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
Devralma
WorkflowEventArgs
Türetilmiş
Öznitelikler

Örnekler

Aşağıdaki kod örneği, bir WorkflowInstance olay işleyici yöntemi çağrıldığında özelliğini kullanarak WorkflowInstance bir nesnenin nasıl alınduğunu gösterir. Olay gerçekleştiğinde WorkflowIdled , OnWorkflowIdled bu örnekte tanımlanan yöntem çağrılır. özelliği kullanılarak hangi iş akışının WorkflowInstance boşta olduğunu belirler ve ardından yöntemini çağırarak GetWorkflowQueueData iş akışı örneği için kuyruğa alınmış öğeler koleksiyonunu alır. Kod, iş akışının boşta olduğu olayı hangi etkinliğin beklediğini belirlemek için koleksiyon üzerinde yinelenir. Ardından, olay kuyruğu öğesinin adıyla birlikte yöntemini kullanarak EnqueueItem iş akışı kuyruğuna bir özel durum gönderir.

Bu kod örneği, Program.cs dosyasından İş Akışı SDK'sı Örneğini İptal Etme işleminin bir parçasıdır. Daha fazla bilgi için bkz. İş Akışını İptal Etme.

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

Açıklamalar

Not

Bu malzeme artık kullanılmayan türleri ve ad alanlarını açıklamaktadır. Daha fazla bilgi için bkz. Windows Workflow Foundation 4.5'te Kullanım Dışı Türler.

İş akışı olayları bir iş akışı örneğiyle ilişkilendirilir. a WorkflowEventArgs , iş akışı olayıyla ilişkili öğesini içerir WorkflowInstance . sınıfından WorkflowEventArgs türetilen WorkflowEventArgs bir veya nesnesi, sınıfındaki tüm iş akışı olaylarının WorkflowRuntime verilerini sağlar. WorkflowEventArgs, WorkflowSuspendedEventArgsve WorkflowTerminatedEventArgsiçin WorkflowCompletedEventArgstemel sınıftır.

Özellikler

WorkflowInstance
Geçersiz.

İş akışı olayıyla ilişkili iş akışı örneğini alır.

Yöntemler

Equals(Object)
Geçersiz.

Belirtilen nesnenin geçerli nesneye eşit olup olmadığını belirler.

(Devralındığı yer: Object)
GetHashCode()
Geçersiz.

Varsayılan karma işlevi işlevi görür.

(Devralındığı yer: Object)
GetType()
Geçersiz.

Type Geçerli örneğini alır.

(Devralındığı yer: Object)
MemberwiseClone()
Geçersiz.

Geçerli Objectöğesinin sığ bir kopyasını oluşturur.

(Devralındığı yer: Object)
ToString()
Geçersiz.

Geçerli nesneyi temsil eden dizeyi döndürür.

(Devralındığı yer: Object)

Şunlara uygulanır

Ayrıca bkz.