แชร์ผ่าน


DialogContext Class

Definition

Provides context for the current state of the dialog stack.

public class DialogContext
type DialogContext = class
Public Class DialogContext
Inheritance
DialogContext
Derived

Remarks

The Context property contains the ITurnContext for the current turn.

Constructors

DialogContext(DialogSet, DialogContext, DialogState)

Initializes a new instance of the DialogContext class.

DialogContext(DialogSet, ITurnContext, DialogState)

Initializes a new instance of the DialogContext class from the turn context.

Properties

ActiveDialog

Gets the cached instance of the active dialog on the top of the stack or null if the stack is empty.

Child

Gets dialog context for child if there is an active child.

Context

Gets the context for the current turn of conversation.

DialogManager
Obsolete.

Gets the current DialogManager for this dialogContext. This property is obsolete.

Dialogs

Gets the set of dialogs which are active for the current dialog container.

Parent

Gets or sets the parent DialogContext, if any. Used when searching for the ID of a dialog to start.

Services

Gets the services collection which is contextual to this dialog context.

Stack

Gets the current dialog stack.

State

Gets or sets the DialogStateManager which manages view of all memory scopes.

Methods

BeginDialogAsync(String, Object, CancellationToken)

Starts a new dialog and pushes it onto the dialog stack.

CancelAllDialogsAsync(Boolean, String, Object, CancellationToken)

Deletes any existing dialog stack thus canceling all dialogs on the stack.

CancelAllDialogsAsync(CancellationToken)

Deletes any existing dialog stack thus canceling all dialogs on the stack.

ContinueDialogAsync(CancellationToken)

Continues execution of the active dialog, if there is one, by passing the current DialogContext to the active dialog's ContinueDialogAsync(DialogContext, CancellationToken) method.

EmitEventAsync(String, Object, Boolean, Boolean, CancellationToken)

Searches for a dialog with a given ID. Emits a named event for the current dialog, or someone who started it, to handle.

EndDialogAsync(Object, CancellationToken)

Ends a dialog by popping it off the stack and returns an optional result to the dialog's parent. The parent dialog is the dialog the started the on being ended via a call to either BeginDialogAsync(String, Object, CancellationToken) or PromptAsync(String, PromptOptions, CancellationToken). The parent dialog will have its ResumeDialogAsync(DialogContext, DialogReason, Object, CancellationToken) method invoked with any returned result. If the parent dialog hasn't implemented a ResumeDialogAsync method, then it will be automatically ended as well and the result passed to its parent. If there are no more parent dialogs on the stack then processing of the turn will end.

FindDialog(String)

Find the dialog id for the given context.

GetLocale()

Obtain the CultureInfo in DialogContext.

PromptAsync(String, PromptOptions, CancellationToken)

Helper function to simplify formatting the options for calling a prompt dialog. This helper will take an options argument and then call BeginDialogAsync(String, Object, CancellationToken).

ReplaceDialogAsync(String, Object, CancellationToken)

Starts a new dialog and replaces on the stack the currently active dialog with the new one. This is particularly useful for creating loops or redirecting to another dialog.

RepromptDialogAsync(CancellationToken)

Calls the currently active dialog's RepromptDialogAsync(ITurnContext, DialogInstance, CancellationToken) method. Used with dialogs that implement a re-prompt behavior.

Extension Methods

DebuggerStepAsync(DialogContext, OnCondition, DialogEvent, CancellationToken)

Call into active IDialogDebugger and let it know that we are at given point.

DebuggerStepAsync(DialogContext, Dialog, String, CancellationToken)

Call into active IDialogDebugger and let it know that we are at given point in the dialog.

DebuggerStepAsync(DialogContext, Recognizer, String, CancellationToken)

Call into active IDialogDebugger and let it know that we are at given point in the Recognizer.

DebuggerStepAsync(DialogContext, IRecognizer, String, CancellationToken)

Call into active IDialogDebugger and let it know that we are at given point in the Recognizer.

GetDebugger(DialogContext)

Extension method to get IDialogDebugger from DialogContext.

Applies to