ComponentDialog 类

public class ComponentDialog
extends DialogContainer

由其他对话组成的 Dialog。 组件对话具有内部 DialogSetDialogContext,它提供从父对话隐藏的内部对话堆栈。

字段摘要

修饰符和类型 字段和描述
static final java.lang.String PERSISTEDDIALOGSTATE

持久化对话框状态的 ID。

构造函数摘要

构造函数 说明
ComponentDialog(String dialogId)

初始化 ComponentDialog 类的新实例。

方法摘要

修饰符和类型 方法和描述
ComponentDialog addDialog(Dialog dialog)

将新的 Dialog 添加到组件对话框,并返回更新的组件。

java.util.concurrent.CompletableFuture<DialogTurnResult> beginDialog(DialogContext outerDc, Object options)

启动对话并将其推送到父级对话堆栈时调用。

java.util.concurrent.CompletableFuture<DialogTurnResult> continueDialog(DialogContext outerDc)

当对话框为 _continued_时调用,其中它是活动对话,用户使用新活动进行答复。

DialogContext createChildContext(DialogContext dc)

创建内部 DialogContext

protected java.util.concurrent.CompletableFuture<DialogTurnResult> endComponent(DialogContext outerDc, Object result)

在其父上下文中结束组件对话框。

java.util.concurrent.CompletableFuture<java.lang.Void> endDialog(TurnContext turnContext, DialogInstance instance, DialogReason reason)

对话框结束时调用。

protected java.util.concurrent.CompletableFuture<java.lang.Void> ensureInitialized(DialogContext outerDc)

确保对话已初始化。

java.lang.String getInitialDialogId()

获取分配给初始对话框的 ID。

protected java.util.concurrent.CompletableFuture<DialogTurnResult> onBeginDialog(DialogContext innerDc, Object options)

启动对话并将其推送到父级对话堆栈时调用。

protected java.util.concurrent.CompletableFuture<DialogTurnResult> onContinueDialog(DialogContext innerDc)

当对话框为 _continued_时调用,其中它是活动对话,用户使用新活动进行答复。

protected java.util.concurrent.CompletableFuture<java.lang.Void> onEndDialog(TurnContext context, DialogInstance instance, DialogReason reason)

对话框结束时调用。

protected java.util.concurrent.CompletableFuture<java.lang.Void> onInitialize(DialogContext dc)

初始化对话。

protected java.util.concurrent.CompletableFuture<java.lang.Void> onRepromptDialog(TurnContext turnContext, DialogInstance instance)

当对话框应重新提示用户输入时调用。

java.util.concurrent.CompletableFuture<java.lang.Void> repromptDialog(TurnContext turnContext, DialogInstance instance)

当对话框应重新提示用户输入时调用。

java.util.concurrent.CompletableFuture<DialogTurnResult> resumeDialog(DialogContext outerDc, DialogReason reason, Object result)

当父对话堆栈上的子对话完成此轮次时调用,并将控件返回到此对话组件。

void setInitialDialogId(String withInitialDialogId)

设置分配给初始对话框的 ID。

方法继承自 Dialog

方法继承自 DialogContainer

方法继承自 java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

字段详细信息

PERSISTEDDIALOGSTATE

public static final String PERSISTEDDIALOGSTATE

持久化对话框状态的 ID。

构造函数详细信息

ComponentDialog

public ComponentDialog(String dialogId)

初始化 ComponentDialog 类的新实例。

参数:

dialogId - 要分配给父对话集中新对话框的 D。

方法详细信息

addDialog

public ComponentDialog addDialog(Dialog dialog)

将新的 Dialog 添加到组件对话框,并返回更新的组件。

参数:

dialog - 要添加的对话。

返回:

作完成后 ComponentDialog
     The added dialog's <xref uid="com.microsoft.bot.dialogs.Dialog.telemetryClient" data-throw-if-not-resolved="false" data-raw-source="Dialog#telemetryClient"></xref> is set to the
     <xref uid="com.microsoft.bot.dialogs.DialogContainer.telemetryClient" data-throw-if-not-resolved="false" data-raw-source="DialogContainer#telemetryClient"></xref> of the component dialog.

beginDialog

public CompletableFuture beginDialog(DialogContext outerDc, Object options)

启动对话并将其推送到父级对话堆栈时调用。

替代:

ComponentDialog.beginDialog(DialogContext outerDc, Object options)

参数:

outerDc - 当前会话轮次的父 DialogContext
options - 可选,要传递给对话框的初始信息。

返回:

表示 hronous作的 CompletableFuture
     If the task is successful, the result indicates whether the dialog is
     still active after the turn has been processed by the dialog.

continueDialog

public CompletableFuture continueDialog(DialogContext outerDc)

当对话框为 _continued_时调用,其中它是活动对话,用户使用新活动进行答复。

替代:

ComponentDialog.continueDialog(DialogContext outerDc)

参数:

outerDc - 当前会话轮次的父 DialogContext

返回:

表示 hronous作的 CompletableFuture
     If the task is successful, the result indicates whether the dialog is
     still active after the turn has been processed by the dialog. The
     result may also contain a return value. If this method is *not*
     overridden, the component dialog calls the
     <xref uid="com.microsoft.bot.dialogs.DialogContext.continueDialog*" data-throw-if-not-resolved="false" data-raw-source="DialogContext#continueDialog(CancellationToken)"></xref> method on its
     inner dialog context. If the inner dialog stack is empty, the
     component dialog ends, and if a <xref uid="com.microsoft.bot.dialogs.DialogTurnResult.result" data-throw-if-not-resolved="false" data-raw-source="DialogTurnResult#result"></xref> is
     available, the component dialog uses that as its return value.

createChildContext

public DialogContext createChildContext(DialogContext dc)

创建内部 DialogContext

替代:

ComponentDialog.createChildContext(DialogContext dc)

参数:

dc - 父 DialogContext

返回:

创建的对话框上下文。

endComponent

protected CompletableFuture endComponent(DialogContext outerDc, Object result)

在其父上下文中结束组件对话框。

参数:

outerDc - 当前会话轮次的父 DialogContext
result - 可选,用于从对话框组件返回到父上下文的值。

返回:

表示要执行的工作的任务。
     If the task is successful, the result indicates that the dialog ended
     after the turn was processed by the dialog. In general, the parent
     context is the dialog or bot turn handler that started the dialog. If
     the parent is a dialog, the stack calls the parent's
     <xref uid="com.microsoft.bot.dialogs.Dialog.resumeDialog(com.microsoft.bot.dialogs.DialogContext,com.microsoft.bot.dialogs.DialogReason,java.lang.Object)" data-throw-if-not-resolved="false" data-raw-source="Dialog#resumeDialog(DialogContext, DialogReason, Object)"></xref>
     method to return a result to the parent dialog. If the parent dialog
     does not implement `ResumeDialog`, then the parent will end, too, and
     the result is passed to the next parent context, if one exists. The
     returned <xref uid="com.microsoft.bot.dialogs.DialogTurnResult" data-throw-if-not-resolved="false" data-raw-source="DialogTurnResult"></xref> contains the return value in its
     <xref uid="com.microsoft.bot.dialogs.DialogTurnResult.result" data-throw-if-not-resolved="false" data-raw-source="DialogTurnResult#result"></xref> property.

endDialog

public CompletableFuture endDialog(TurnContext turnContext, DialogInstance instance, DialogReason reason)

对话框结束时调用。

替代:

ComponentDialog.endDialog(TurnContext turnContext, DialogInstance instance, DialogReason reason)

参数:

turnContext - 此轮次的上下文对象。
instance - 与其父对话堆栈上的此组件对话框实例关联的状态信息。
reason - 对话框结束的原因。

返回:

表示 hronous作的 CompletableFuture
     When this method is called from the parent dialog's context, the
     component dialog cancels all of the dialogs on its inner dialog stack
     before ending.

ensureInitialized

protected CompletableFuture ensureInitialized(DialogContext outerDc)

确保对话已初始化。

参数:

outerDc - 外部 DialogContext

返回:

表示 hronous作的 CompletableFuture

getInitialDialogId

public String getInitialDialogId()

获取分配给初始对话框的 ID。

返回:

InitialDialogId 值作为字符串。

onBeginDialog

protected CompletableFuture onBeginDialog(DialogContext innerDc, Object options)

启动对话并将其推送到父级对话堆栈时调用。

参数:

innerDc - 当前会话轮次的内部 DialogContext
options - 可选,要传递给对话框的初始信息。

返回:

表示 hronous作的 CompletableFuture
     If the task is successful, the result indicates whether the dialog is
     still active after the turn has been processed by the dialog. By
     default, this calls the
     <xref uid="com.microsoft.bot.dialogs.Dialog.beginDialog(com.microsoft.bot.dialogs.DialogContext,java.lang.Object)" data-throw-if-not-resolved="false" data-raw-source="Dialog#beginDialog(DialogContext, Object)"></xref> method of the
     component dialog's initial dialog, as defined by
     InitialDialogId . Override this method in a derived class to
     implement interrupt logic.

onContinueDialog

protected CompletableFuture onContinueDialog(DialogContext innerDc)

当对话框为 _continued_时调用,其中它是活动对话,用户使用新活动进行答复。

参数:

innerDc - 当前会话轮次的内部 DialogContext

返回:

表示 hronous作的 CompletableFuture
     If the task is successful, the result indicates whether the dialog is
     still active after the turn has been processed by the dialog. The
     result may also contain a return value. By default, this calls the
     currently active inner dialog's
     <xref uid="com.microsoft.bot.dialogs.Dialog.continueDialog(com.microsoft.bot.dialogs.DialogContext)" data-throw-if-not-resolved="false" data-raw-source="Dialog#continueDialog(DialogContext)"></xref> method. Override this
     method in a derived class to implement interrupt logic.

onEndDialog

protected CompletableFuture onEndDialog(TurnContext context, DialogInstance instance, DialogReason reason)

对话框结束时调用。

参数:

context - 此轮次的上下文对象。
instance - 与此组件对话的内部对话堆栈关联的状态信息。
reason - 对话框结束的原因。

返回:

表示 hronous作的 CompletableFuture
     Override this method in a derived class to implement any additional
     logic that should happen at the component level, after all inner
     dialogs have been canceled.

onInitialize

protected CompletableFuture onInitialize(DialogContext dc)

初始化对话。

参数:

dc - 要初始化的 DialogContext

返回:

表示 hronous作的 CompletableFuture

onRepromptDialog

protected CompletableFuture onRepromptDialog(TurnContext turnContext, DialogInstance instance)

当对话框应重新提示用户输入时调用。

参数:

turnContext - 此轮次的上下文对象。
instance - 与此组件对话的内部对话堆栈关联的状态信息。

返回:

表示 hronous作的 CompletableFuture
     Override this method in a derived class to implement any additional
     logic that should happen at the component level, after the re-prompt
     operation completes for the inner dialog.

repromptDialog

public CompletableFuture repromptDialog(TurnContext turnContext, DialogInstance instance)

当对话框应重新提示用户输入时调用。

替代:

ComponentDialog.repromptDialog(TurnContext turnContext, DialogInstance instance)

参数:

turnContext - 此轮次的上下文对象。
instance - 此对话框的状态信息。

返回:

表示 hronous作的 CompletableFuture

resumeDialog

public CompletableFuture resumeDialog(DialogContext outerDc, DialogReason reason, Object result)

当父对话堆栈上的子对话完成此轮次时调用,并将控件返回到此对话组件。

替代:

ComponentDialog.resumeDialog(DialogContext outerDc, DialogReason reason, Object result)

参数:

outerDc - 当前对话轮次的 DialogContext
reason - 对话恢复的原因。
result - 可选,从调用的对话框返回的值。 返回的值的类型取决于子对话。

返回:

表示 hronous作的 CompletableFuture
     If the task is successful, the result indicates whether this dialog
     is still active after this dialog turn has been processed. Generally,
     the child dialog was started with a call to
     BeginDialog(DialogContext, Object) in the parent's context.
     However, if the <xref uid="com.microsoft.bot.dialogs.DialogContext.replaceDialog(java.lang.String,java.lang.Object)" data-throw-if-not-resolved="false" data-raw-source="DialogContext#replaceDialog(String, Object)"></xref>
     method is called, the logical child dialog may be different than the
     original. If this method is *not* overridden, the dialog
     automatically calls its RepromptDialog(TurnContext,
     DialogInstance) when the user replies.

setInitialDialogId

public void setInitialDialogId(String withInitialDialogId)

设置分配给初始对话框的 ID。

参数:

withInitialDialogId - InitialDialogId 值。

适用于