WorkflowApplication.Idle 屬性

定義

取得或設定現有工作流程執行個體故障時叫用的 Action<T>Gets or sets the Action<T> that is invoked when the current workflow instance becomes idle.

public:
 property Action<System::Activities::WorkflowApplicationIdleEventArgs ^> ^ Idle { Action<System::Activities::WorkflowApplicationIdleEventArgs ^> ^ get(); void set(Action<System::Activities::WorkflowApplicationIdleEventArgs ^> ^ value); };
public Action<System.Activities.WorkflowApplicationIdleEventArgs> Idle { get; set; }
member this.Idle : Action<System.Activities.WorkflowApplicationIdleEventArgs> with get, set
Public Property Idle As Action(Of WorkflowApplicationIdleEventArgs)

屬性值

在工作流程執行個體閒置時執行的動作。An action that executes when a workflow instance becomes idle.

範例

下列程式碼範例會檢查傳遞給 WorkflowApplicationIdleEventArgs 執行個體之 Idle 處理常式的 WorkflowApplicationThe following code example inspects the WorkflowApplicationIdleEventArgs passed into the Idle handler of a WorkflowApplication instance. 在此範例中,處於閒置狀態的工作流程具有一個名為 Bookmark 且由名為 EnterGuess 之活動所擁有的 ReadIntIn this example the workflow going idle has one Bookmark with a name of EnterGuess, owned by an activity named ReadInt. 這個程式碼範例是根據如何:執行工作流程, 這是消費者入門[教學課程 .NET Framework 4.5]的一部分。This code example is based off of How to: Run a Workflow, which is part of the Getting Started Tutorial [.NET Framework 4.5]. 如果該步驟中的 Idle 處理常式修改為包含此範例中的程式碼,就會顯示下列輸出。If the Idle handler in that step is modified to contain the code from this example, the following output is displayed.

BookmarkName: EnterGuess - OwnerDisplayName: ReadInt  
wfApp.Idle = delegate(WorkflowApplicationIdleEventArgs e)
{
    foreach (BookmarkInfo info in e.Bookmarks)
    {
        Console.WriteLine("BookmarkName: {0} - OwnerDisplayName: {1}",
            info.BookmarkName, info.OwnerDisplayName);
    }

    idleEvent.Set();
};

適用於