WorkflowApplication.ResumeBookmark Metodo

Definizione

Inizia un'operazione per riprendere un segnalibro.

Overload

ResumeBookmark(String, Object, TimeSpan)

Inizia un'operazione per riprendere il segnalibro con il nome specificato, utilizzando il valore specificato e l'intervallo di timeout. Il segnalibro da riprendere viene creato precedentemente da un'attività all'interno dell'istanza del flusso di lavoro.

ResumeBookmark(Bookmark, Object, TimeSpan)

Inizia un'operazione per riprendere il segnalibro specificato utilizzando il valore specificato e l'intervallo di timeout. Il segnalibro da riprendere viene creato precedentemente da un'attività all'interno dell'istanza del flusso di lavoro.

ResumeBookmark(Bookmark, Object)

Inizia un'operazione per riprendere il segnalibro specificato utilizzando il valore specificato. Il segnalibro da riprendere viene creato precedentemente da un'attività all'interno dell'istanza del flusso di lavoro.

ResumeBookmark(String, Object)

Inizia un'operazione per riprendere il segnalibro con il nome specificato, utilizzando il valore specificato. Il segnalibro da riprendere viene creato precedentemente da un'attività all'interno dell'istanza del flusso di lavoro.

ResumeBookmark(String, Object, TimeSpan)

Inizia un'operazione per riprendere il segnalibro con il nome specificato, utilizzando il valore specificato e l'intervallo di timeout. Il segnalibro da riprendere viene creato precedentemente da un'attività all'interno dell'istanza del flusso di lavoro.

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

Parametri

bookmarkName
String

Il nome del segnalibro da riprendere.

value
Object

Un oggetto passato come un parametro al metodo richiamato quando il segnalibro è ripreso.

timeout
TimeSpan

L'intervallo di tempo durante il quale il segnalibro deve essere ripreso.

Restituisce

Risultato dell'operazione di ripresa del segnalibro.

Esempio

Nell'esempio seguente viene creato un flusso di lavoro che utilizza un'attività ReadLine che crea un oggetto Bookmark. Dopo l'avvio del flusso di lavoro, la creazione dell'oggetto Bookmark e il passaggio del flusso di lavoro sullo stato inattivo, viene raccolto l'input dell'utente e viene ripreso il segnalibro.

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

Commenti

Il risultato del segnalibro indica se l'operazione di ripresa è riuscita o non riuscita.

Si applica a

ResumeBookmark(Bookmark, Object, TimeSpan)

Inizia un'operazione per riprendere il segnalibro specificato utilizzando il valore specificato e l'intervallo di timeout. Il segnalibro da riprendere viene creato precedentemente da un'attività all'interno dell'istanza del flusso di lavoro.

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

Parametri

bookmark
Bookmark

Segnalibro da riprendere.

value
Object

Un oggetto passato come un parametro al metodo richiamato quando il segnalibro è ripreso.

timeout
TimeSpan

L'intervallo di tempo durante il quale il segnalibro deve essere ripreso.

Restituisce

Risultato dell'operazione di ripresa del segnalibro.

Esempio

Nell'esempio seguente viene creato un flusso di lavoro che utilizza un'attività ReadLine che crea un oggetto Bookmark. Dopo l'avvio del flusso di lavoro, la creazione dell'oggetto Bookmark e il passaggio del flusso di lavoro sullo stato inattivo, viene raccolto l'input dell'utente e viene ripreso il segnalibro.

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

Commenti

Il risultato del segnalibro indica se l'operazione di ripresa è riuscita o non riuscita.

Si applica a

ResumeBookmark(Bookmark, Object)

Inizia un'operazione per riprendere il segnalibro specificato utilizzando il valore specificato. Il segnalibro da riprendere viene creato precedentemente da un'attività all'interno dell'istanza del flusso di lavoro.

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

Parametri

bookmark
Bookmark

Segnalibro da riprendere.

value
Object

Un oggetto passato come un parametro al metodo richiamato quando il segnalibro è ripreso.

Restituisce

Risultato dell'operazione di ripresa del segnalibro.

Esempio

Nell'esempio seguente viene creato un flusso di lavoro che utilizza un'attività ReadLine che crea un oggetto Bookmark. Dopo l'avvio del flusso di lavoro, la creazione dell'oggetto Bookmark e il passaggio del flusso di lavoro sullo stato inattivo, viene raccolto l'input dell'utente e viene ripreso il segnalibro.

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

Commenti

Il risultato del segnalibro indica se l'operazione di ripresa è riuscita o non riuscita.

Si applica a

ResumeBookmark(String, Object)

Inizia un'operazione per riprendere il segnalibro con il nome specificato, utilizzando il valore specificato. Il segnalibro da riprendere viene creato precedentemente da un'attività all'interno dell'istanza del flusso di lavoro.

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

Parametri

bookmarkName
String

Il nome del segnalibro da riprendere.

value
Object

Un oggetto passato come un parametro al metodo richiamato quando il segnalibro è ripreso.

Restituisce

Risultato dell'operazione di ripresa del segnalibro.

Esempio

Nell'esempio seguente viene creato un flusso di lavoro che utilizza un'attività ReadLine che crea un oggetto Bookmark. Dopo l'avvio del flusso di lavoro, la creazione dell'oggetto Bookmark e il passaggio del flusso di lavoro sullo stato inattivo, viene raccolto l'input dell'utente e viene ripreso il segnalibro.

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

Commenti

Il risultato del segnalibro indica se l'operazione di ripresa è riuscita o non riuscita.

Si applica a