Export (0) Print
Expand All

WorkflowApplication.ResumeBookmark Method (String, Object, TimeSpan)

Initiates an operation to resume the bookmark with the specified name, using the specified value and time-out interval. The bookmark to be resumed is previously created by an activity within the workflow instance.

Namespace:  System.Activities
Assembly:  System.Activities (in System.Activities.dll)

Public Function ResumeBookmark ( _
	bookmarkName As String, _
	value As Object, _
	timeout As TimeSpan _
) As BookmarkResumptionResult


Type: System.String

The name of the bookmark to be resumed.

Type: System.Object

An object passed as a parameter to the method that is invoked when the bookmark resumes.

Type: System.TimeSpan

The time interval during which the bookmark must be resumed.

Return Value

Type: System.Activities.BookmarkResumptionResult
The result of the bookmark resumption operation.

The bookmark result indicates whether the resumption operation succeeded or failed.

The following example creates a workflow that uses a ReadLine activity that creates a Bookmark. The workflow is started, and once the Bookmark is created and the workflow goes idle, the user's input is gathered and the bookmark is resumed.

public sealed class ReadLine : NativeActivity<string>
    public InArgument<string> BookmarkName { get; set; }

    protected override void Execute(NativeActivityContext context)
        // Create a Bookmark and wait for it to be resumed.
            new BookmarkCallback(OnResumeBookmark));

    // NativeActivity derived activities that do asynchronous operations by calling  
    // one of the CreateBookmark overloads defined on System.Activities.NativeActivityContext  
    // must override the CanInduceIdle property and return true. 
    protected override bool CanInduceIdle
        get { return true; }

    public void OnResumeBookmark(NativeActivityContext context, Bookmark bookmark, object obj)
        // When the Bookmark is resumed, assign its value to 
        // the Result argument.
        Result.Set(context, (string)obj);
Variable<string> name = new Variable<string>();

Activity wf = new Sequence
    Variables = { name },
    Activities =
         new WriteLine
             Text = "What is your name?"
         new ReadLine
             BookmarkName = "UserName",
             Result = new OutArgument<string>(name)

         new WriteLine
             Text = new InArgument<string>((env) => 
                 ("Hello, " + name.Get(env)))

// Create a WorkflowApplication instance.
WorkflowApplication wfApp = new WorkflowApplication(wf);

// Workflow lifecycle events omitted except idle.
AutoResetEvent idleEvent = new AutoResetEvent(false);

wfApp.Idle = delegate(WorkflowApplicationIdleEventArgs e)

// Run the workflow.

// Wait for the workflow to go idle before gathering 
// the user's input.

// Gather the user's input and resume the bookmark. 
// Bookmark resumption only occurs when the workflow 
// is idle. If a call to ResumeBookmark is made and the workflow 
// is not idle, ResumeBookmark blocks until the workflow becomes 
// idle before resuming the bookmark.
BookmarkResumptionResult result = wfApp.ResumeBookmark("UserName", 

// Possible BookmarkResumptionResult values: 
// Success, NotFound, or NotReady
Console.WriteLine("BookmarkResumptionResult: {0}", result);

.NET Framework

Supported in: 4.5, 4

.NET Framework Client Profile

Supported in: 4

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft