WorkflowInstance.Suspend(String) 方法

定义

挂起工作流实例。

public:
 void Suspend(System::String ^ error);
public void Suspend (string error);
member this.Suspend : string -> unit
Public Sub Suspend (error As String)

参数

error
String

挂起工作流实例原因的说明。

例外

工作流运行时引擎未运行。

示例

下面的代码示例演示如何在 WorkflowInstance 对象上调用“Suspend”。

// Create a workflow runtime
WorkflowRuntime workflowRuntime = new WorkflowRuntime();
// Create a workflow instance
WorkflowInstance workflowInstance = workflowRuntime.CreateWorkflow(typeof(Workflow1));
// Start the workflow
workflowInstance.Start();
// Suspend the workflow, passing in a message
workflowInstance.Suspend("Workflow manually suspended");
' Create a workflow runtime
Dim workflowRuntime As New WorkflowRuntime()
' Create a workflow instance
Dim workflowInstance As WorkflowInstance = workflowRuntime.CreateWorkflow(GetType(Workflow1))
' Start the workflow
workflowInstance.Start()
' Suspend the workflow, passing in a message
workflowInstance.Suspend("Workflow manually suspended")

注解

此工作流实例是以同步方式挂起的。 如果工作流实例已经挂起,则不执行任何操作;否则,工作流运行时引擎将挂起工作流实例,引发 WorkflowSuspended 事件,并在 reason 中传递 WorkflowSuspendedEventArgs

注意

Suspend 不会卸载此工作流实例。

适用于