ComponentDialog 類別

public class ComponentDialog
extends DialogContainer

由其他對話框組成的 Dialog。 元件對話具有內部 DialogSetDialogContext ,其提供從父對話隱藏的內部對話堆棧。

欄位摘要

修飾詞與類型 欄位與描述
static final java.lang.String PERSISTEDDIALOGSTATE

保存對話框狀態的識別碼。

建構函式摘要

建構函式 Description
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()

取得指派給初始對話框的標識碼。

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)

設定指派給初始對話框的標識碼。

方法繼承來源 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

保存對話框狀態的識別碼。

建構函式詳細資料

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

取得指派給初始對話框的標識碼。

傳回:

InitialDialogId 值做為 String。

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)

設定指派給初始對話框的標識碼。

參數:

withInitialDialogId - InitialDialogId 值。

適用於