Uređivanje

Dijeli putem


WorkflowInstance.Suspend(String) Method

Definition

Suspends the workflow instance.

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

Parameters

error
String

A description of the reason for suspending the workflow instance.

Exceptions

The workflow runtime engine is not running.

Examples

The following code example demonstrates calling Suspend on a WorkflowInstance object.

// 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")

Remarks

The workflow instance is suspended in a synchronous manner. If the workflow instance is already suspended, no action is taken; otherwise, the workflow runtime engine suspends the workflow instance, raises the WorkflowSuspended event and passes reason in a WorkflowSuspendedEventArgs.

Note

Suspend does not unload the workflow instance.

Applies to