WorkflowApplication.ResumeBookmark 方法

定義

啟始繼續書籤的作業。Initiates an operation to resume a bookmark.

多載

ResumeBookmark(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.

ResumeBookmark(Bookmark, Object, TimeSpan)

使用指定的值與逾時間隔啟始繼續指定書籤的作業。Initiates an operation to resume the specified bookmark, using the specified value and time-out interval. 要繼續的書籤是由工作流程執行個體中的活動事先建立的。The bookmark to be resumed is previously created by an activity within the workflow instance.

ResumeBookmark(Bookmark, Object)

使用指定的值啟始繼續指定書籤的作業。Initiates an operation to resume the specified bookmark, using the specified value. 要繼續的書籤是由工作流程執行個體中的活動事先建立的。The bookmark to be resumed is previously created by an activity within the workflow instance.

ResumeBookmark(String, Object)

使用指定的值啟始繼續書籤 (具有指定名稱) 的作業。Initiates an operation to resume the bookmark with the specified name, using the specified value. 要繼續的書籤是由工作流程執行個體中的活動事先建立的。The bookmark to be resumed is previously created by an activity within the workflow instance.

ResumeBookmark(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.

public:
 System::Activities::BookmarkResumptionResult ResumeBookmark(System::String ^ bookmarkName, System::Object ^ value, TimeSpan timeout);
public System.Activities.BookmarkResumptionResult ResumeBookmark (string bookmarkName, object value, TimeSpan timeout);
member this.ResumeBookmark : string * obj * TimeSpan -> System.Activities.BookmarkResumptionResult
Public Function ResumeBookmark (bookmarkName As String, value As Object, timeout As TimeSpan) As BookmarkResumptionResult

參數

bookmarkName
String

要繼續的書籤名稱。The name of the bookmark to be resumed.

value
Object

繼續書籤時,做為參數傳遞至所叫用方法的物件。An object passed as a parameter to the method that is invoked when the bookmark resumes.

timeout
TimeSpan

書籤必須在期間內繼續的時間間隔。The time interval during which the bookmark must be resumed.

傳回

書籤繼續作業的結果。The result of the bookmark resumption operation.

範例

下列範例會建立使用 ReadLine 活動的工作流程,而這個活動會建立 BookmarkThe following example creates a workflow that uses a ReadLine activity that creates a Bookmark. 系統會啟動工作流程,而且一旦建立 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>
{
    [RequiredArgument]
    public InArgument<string> BookmarkName { get; set; }

    protected override void Execute(NativeActivityContext context)
    {
        // Create a Bookmark and wait for it to be resumed.
        context.CreateBookmark(BookmarkName.Get(context),
            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)
{
    idleEvent.Set();
};

// Run the workflow.
wfApp.Run();

// Wait for the workflow to go idle before gathering
// the user's input.
idleEvent.WaitOne();

// 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", 
    Console.ReadLine());

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

備註

書籤結果會指出繼續作業是成功或是失敗。The bookmark result indicates whether the resumption operation succeeded or failed.

ResumeBookmark(Bookmark, Object, TimeSpan)

使用指定的值與逾時間隔啟始繼續指定書籤的作業。Initiates an operation to resume the specified bookmark, using the specified value and time-out interval. 要繼續的書籤是由工作流程執行個體中的活動事先建立的。The bookmark to be resumed is previously created by an activity within the workflow instance.

public:
 System::Activities::BookmarkResumptionResult ResumeBookmark(System::Activities::Bookmark ^ bookmark, System::Object ^ value, TimeSpan timeout);
public System.Activities.BookmarkResumptionResult ResumeBookmark (System.Activities.Bookmark bookmark, object value, TimeSpan timeout);
member this.ResumeBookmark : System.Activities.Bookmark * obj * TimeSpan -> System.Activities.BookmarkResumptionResult

參數

bookmark
Bookmark

要繼續的書籤。The bookmark to resume.

value
Object

繼續書籤時,做為參數傳遞至所叫用方法的物件。An object passed as a parameter to the method that is invoked when the bookmark resumes.

timeout
TimeSpan

書籤必須在期間內繼續的時間間隔。The time interval during which the bookmark must be resumed.

傳回

書籤繼續作業的結果。The result of the bookmark resumption operation.

範例

下列範例會建立使用 ReadLine 活動的工作流程,而這個活動會建立 BookmarkThe following example creates a workflow that uses a ReadLine activity that creates a Bookmark. 系統會啟動工作流程,而且一旦建立 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>
{
    [RequiredArgument]
    public InArgument<string> BookmarkName { get; set; }

    protected override void Execute(NativeActivityContext context)
    {
        // Create a Bookmark and wait for it to be resumed.
        context.CreateBookmark(BookmarkName.Get(context),
            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)
{
    idleEvent.Set();
};

// Run the workflow.
wfApp.Run();

// Wait for the workflow to go idle before gathering
// the user's input.
idleEvent.WaitOne();

// Gather the user's input and resume the bookmark.
BookmarkResumptionResult result = wfApp.ResumeBookmark(new Bookmark("UserName"), 
    Console.ReadLine(), TimeSpan.FromSeconds(15));

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

備註

書籤結果會指出繼續作業是成功或是失敗。The bookmark result indicates whether the resumption operation succeeded or failed.

ResumeBookmark(Bookmark, Object)

使用指定的值啟始繼續指定書籤的作業。Initiates an operation to resume the specified bookmark, using the specified value. 要繼續的書籤是由工作流程執行個體中的活動事先建立的。The bookmark to be resumed is previously created by an activity within the workflow instance.

public:
 System::Activities::BookmarkResumptionResult ResumeBookmark(System::Activities::Bookmark ^ bookmark, System::Object ^ value);
public System.Activities.BookmarkResumptionResult ResumeBookmark (System.Activities.Bookmark bookmark, object value);
member this.ResumeBookmark : System.Activities.Bookmark * obj -> System.Activities.BookmarkResumptionResult

參數

bookmark
Bookmark

要繼續的書籤。The bookmark to resume.

value
Object

繼續書籤時,做為參數傳遞至所叫用方法的物件。An object passed as a parameter to the method that is invoked when the bookmark resumes.

傳回

書籤繼續作業的結果。The result of the bookmark resumption operation.

範例

下列範例會建立使用 ReadLine 活動的工作流程,而這個活動會建立 BookmarkThe following example creates a workflow that uses a ReadLine activity that creates a Bookmark. 系統會啟動工作流程,而且一旦建立 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>
{
    [RequiredArgument]
    public InArgument<string> BookmarkName { get; set; }

    protected override void Execute(NativeActivityContext context)
    {
        // Create a Bookmark and wait for it to be resumed.
        context.CreateBookmark(BookmarkName.Get(context),
            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)
{
    idleEvent.Set();
};

// Run the workflow.
wfApp.Run();

// Wait for the workflow to go idle before gathering
// the user's input.
idleEvent.WaitOne();

// Gather the user's input and resume the bookmark.
BookmarkResumptionResult result = wfApp.ResumeBookmark(new Bookmark("UserName"), 
    Console.ReadLine());

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

備註

書籤結果會指出繼續作業是成功或是失敗。The bookmark result indicates whether the resumption operation succeeded or failed.

ResumeBookmark(String, Object)

使用指定的值啟始繼續書籤 (具有指定名稱) 的作業。Initiates an operation to resume the bookmark with the specified name, using the specified value. 要繼續的書籤是由工作流程執行個體中的活動事先建立的。The bookmark to be resumed is previously created by an activity within the workflow instance.

public:
 System::Activities::BookmarkResumptionResult ResumeBookmark(System::String ^ bookmarkName, System::Object ^ value);
public System.Activities.BookmarkResumptionResult ResumeBookmark (string bookmarkName, object value);
member this.ResumeBookmark : string * obj -> System.Activities.BookmarkResumptionResult
Public Function ResumeBookmark (bookmarkName As String, value As Object) As BookmarkResumptionResult

參數

bookmarkName
String

要繼續的書籤名稱。The name of the bookmark to be resumed.

value
Object

繼續書籤時,做為參數傳遞至所叫用方法的物件。An object passed as a parameter to the method that is invoked when the bookmark resumes.

傳回

書籤繼續作業的結果。The result of the bookmark resumption operation.

範例

下列範例會建立使用 ReadLine 活動的工作流程,而這個活動會建立 BookmarkThe following example creates a workflow that uses a ReadLine activity that creates a Bookmark. 系統會啟動工作流程,而且一旦建立 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>
{
    [RequiredArgument]
    public InArgument<string> BookmarkName { get; set; }

    protected override void Execute(NativeActivityContext context)
    {
        // Create a Bookmark and wait for it to be resumed.
        context.CreateBookmark(BookmarkName.Get(context),
            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)
{
    idleEvent.Set();
};

// Run the workflow.
wfApp.Run();

// Wait for the workflow to go idle before gathering
// the user's input.
idleEvent.WaitOne();

// 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", 
    Console.ReadLine());

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

備註

書籤結果會指出繼續作業是成功或是失敗。The bookmark result indicates whether the resumption operation succeeded or failed.

適用於