WorkflowApplication.ResumeBookmark メソッド

定義

ブックマークを再開する操作を開始します。

オーバーロード

ResumeBookmark(String, Object, TimeSpan)

指定された値およびタイムアウト期間を使用して、指定された名前を持つブックマークを再開する操作を開始します。 再開するブックマークは、ワークフロー インスタンス内のアクティビティによって以前に作成されたものです。

ResumeBookmark(Bookmark, Object, TimeSpan)

指定された値およびタイムアウト期間を使用して、指定されたブックマークを再開する操作を開始します。 再開するブックマークは、ワークフロー インスタンス内のアクティビティによって以前に作成されたものです。

ResumeBookmark(Bookmark, Object)

指定された値を使用して、指定されたブックマークを再開する操作を開始します。 再開するブックマークは、ワークフロー インスタンス内のアクティビティによって以前に作成されたものです。

ResumeBookmark(String, Object)

指定された値を使用して、指定された名前を持つブックマークを再開する操作を開始します。 再開するブックマークは、ワークフロー インスタンス内のアクティビティによって以前に作成されたものです。

ResumeBookmark(String, Object, TimeSpan)

指定された値およびタイムアウト期間を使用して、指定された名前を持つブックマークを再開する操作を開始します。 再開するブックマークは、ワークフロー インスタンス内のアクティビティによって以前に作成されたものです。

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

再開するブックマークの名前。

value
Object

ブックマークが再開されると呼び出されるメソッドにパラメーターとして渡されるオブジェクト。

timeout
TimeSpan

ブックマークが再開される必要がある時間間隔。

戻り値

ブックマーク再開操作の結果。

次の例は、ReadLine を作成する Bookmark アクティビティを使用するワークフローを作成します。 ワークフローが開始され、Bookmark が作成されてワークフローがアイドル状態になると、ユーザーの入力が収集されてブックマークが再開されます。

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);

注釈

ブックマークの結果は、再開操作に成功したのかそれとも失敗したのかを示します。

適用対象

ResumeBookmark(Bookmark, Object, TimeSpan)

指定された値およびタイムアウト期間を使用して、指定されたブックマークを再開する操作を開始します。 再開するブックマークは、ワークフロー インスタンス内のアクティビティによって以前に作成されたものです。

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
Public Function ResumeBookmark (bookmark As Bookmark, value As Object, timeout As TimeSpan) As BookmarkResumptionResult

パラメーター

bookmark
Bookmark

再開するブックマーク。

value
Object

ブックマークが再開されると呼び出されるメソッドにパラメーターとして渡されるオブジェクト。

timeout
TimeSpan

ブックマークが再開される必要がある時間間隔。

戻り値

ブックマーク再開操作の結果。

次の例は、ReadLine を作成する Bookmark アクティビティを使用するワークフローを作成します。 ワークフローが開始され、Bookmark が作成されてワークフローがアイドル状態になると、ユーザーの入力が収集されてブックマークが再開されます。

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);

注釈

ブックマークの結果は、再開操作に成功したのかそれとも失敗したのかを示します。

適用対象

ResumeBookmark(Bookmark, Object)

指定された値を使用して、指定されたブックマークを再開する操作を開始します。 再開するブックマークは、ワークフロー インスタンス内のアクティビティによって以前に作成されたものです。

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
Public Function ResumeBookmark (bookmark As Bookmark, value As Object) As BookmarkResumptionResult

パラメーター

bookmark
Bookmark

再開するブックマーク。

value
Object

ブックマークが再開されると呼び出されるメソッドにパラメーターとして渡されるオブジェクト。

戻り値

ブックマーク再開操作の結果。

次の例は、ReadLine を作成する Bookmark アクティビティを使用するワークフローを作成します。 ワークフローが開始され、Bookmark が作成されてワークフローがアイドル状態になると、ユーザーの入力が収集されてブックマークが再開されます。

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);

注釈

ブックマークの結果は、再開操作に成功したのかそれとも失敗したのかを示します。

適用対象

ResumeBookmark(String, Object)

指定された値を使用して、指定された名前を持つブックマークを再開する操作を開始します。 再開するブックマークは、ワークフロー インスタンス内のアクティビティによって以前に作成されたものです。

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

再開するブックマークの名前。

value
Object

ブックマークが再開されると呼び出されるメソッドにパラメーターとして渡されるオブジェクト。

戻り値

ブックマーク再開操作の結果。

次の例は、ReadLine を作成する Bookmark アクティビティを使用するワークフローを作成します。 ワークフローが開始され、Bookmark が作成されてワークフローがアイドル状態になると、ユーザーの入力が収集されてブックマークが再開されます。

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);

注釈

ブックマークの結果は、再開操作に成功したのかそれとも失敗したのかを示します。

適用対象