WorkflowRuntime.WorkflowIdled Zdarzenie

Definicja

Występuje, gdy wystąpienie przepływu pracy wchodzi w stan bezczynności.

public:
 event EventHandler<System::Workflow::Runtime::WorkflowEventArgs ^> ^ WorkflowIdled;
public event EventHandler<System.Workflow.Runtime.WorkflowEventArgs> WorkflowIdled;
member this.WorkflowIdled : EventHandler<System.Workflow.Runtime.WorkflowEventArgs> 
Public Custom Event WorkflowIdled As EventHandler(Of WorkflowEventArgs) 
Public Event WorkflowIdled As EventHandler(Of WorkflowEventArgs) 

Typ zdarzenia

Przykłady

W poniższym przykładzie kodu pokazano, jak używać WorkflowRuntime funkcji z hosta przepływu pracy. Kod kojarzy element WorkflowIdled z procedurą obsługi zdarzeń o nazwie OnWorkflowIdled.

Ten przykładowy kod jest częścią przykładu Anulowanie przepływu pracy .

static void Main()
{
    string connectionString = "Initial Catalog=SqlPersistenceService;Data Source=localhost;Integrated Security=SSPI;";

    using (WorkflowRuntime workflowRuntime = new WorkflowRuntime())
    {
        ExternalDataExchangeService dataService = new ExternalDataExchangeService();
        workflowRuntime.AddService(dataService);
        dataService.AddService(expenseService);

        workflowRuntime.AddService(new SqlWorkflowPersistenceService(connectionString));
        workflowRuntime.StartRuntime();

        workflowRuntime.WorkflowCompleted += OnWorkflowCompleted;
        workflowRuntime.WorkflowTerminated += OnWorkflowTerminated;
        workflowRuntime.WorkflowIdled += OnWorkflowIdled;
        workflowRuntime.WorkflowAborted += OnWorkflowAborted;

        Type type = typeof(SampleWorkflow1);
        WorkflowInstance workflowInstance = workflowRuntime.CreateWorkflow(type);
        workflowInstance.Start();

        waitHandle.WaitOne();

        workflowRuntime.StopRuntime();
    }
}
Shared Sub Main()
    Dim connectionString As String = "Initial Catalog=SqlPersistenceService;Data Source=localhost;Integrated Security=SSPI;"
    Using workflowRuntime As New WorkflowRuntime()
        Dim dataService As New ExternalDataExchangeService()
        workflowRuntime.AddService(dataService)
        dataService.AddService(expenseService)

        workflowRuntime.AddService(New SqlWorkflowPersistenceService(connectionString))


        AddHandler workflowRuntime.WorkflowCompleted, AddressOf OnWorkflowCompleted
        AddHandler workflowRuntime.WorkflowTerminated, AddressOf OnWorkflowTerminated
        AddHandler workflowRuntime.WorkflowIdled, AddressOf OnWorkflowIdled
        AddHandler workflowRuntime.WorkflowAborted, AddressOf OnWorkflowAborted


        Dim workflowInstance As WorkflowInstance
        workflowInstance = workflowRuntime.CreateWorkflow(GetType(SampleWorkflow))
        workflowInstance.Start()

        waitHandle.WaitOne()

        workflowRuntime.StopRuntime()
    End Using
End Sub

Uwagi

Aparat czasu wykonywania przepływu pracy zgłasza WorkflowIdled zdarzenie, gdy wystąpienie przepływu pracy wchodzi w stan bezczynności, na przykład gdy przepływ pracy oczekuje na DelayActivity zakończenie działania.

W przypadku tego zdarzenia nadawca zawiera element WorkflowRuntime i WorkflowEventArgs zawiera WorkflowInstance skojarzone ze zdarzeniem.

Aby uzyskać więcej informacji na temat obsługi zdarzeń, zobacz Obsługa i zgłaszanie zdarzeń.

Dotyczy