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)

属性值

Action<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 的活动所拥有的名为 EnterGuessReadIntIn 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();
};

适用于