ComponentDialog 類別
- java.
lang. Object - com.
microsoft. bot. dialogs. Dialog - com.
microsoft. bot. dialogs. DialogContainer - com.
microsoft. bot. dialogs. ComponentDialog
- com.
- com.
- com.
public class ComponentDialog
extends DialogContainer
由其他對話框組成的 Dialog。 元件對話具有內部 DialogSet 和 DialogContext ,其提供從父對話隱藏的內部對話堆棧。
欄位摘要
| 修飾詞與類型 | 欄位與描述 |
|---|---|
| static final java.lang.String |
PERSISTEDDIALOGSTATE
保存對話框狀態的識別碼。 |
建構函式摘要
| 建構函式 | Description |
|---|---|
| ComponentDialog(String dialogId) |
初始化 ComponentDialog 類別的新實例。 |
方法摘要
| 修飾詞與類型 | 方法與描述 |
|---|---|
|
Component |
addDialog(Dialog dialog)
將新的 Dialog 新增至元件對話框,並傳回更新的元件。 |
|
java.util.concurrent.CompletableFuture<Dialog |
beginDialog(DialogContext outerDc, Object options)
啟動對話框並推送至父代對話堆棧時呼叫。 |
|
java.util.concurrent.CompletableFuture<Dialog |
continueDialog(DialogContext outerDc)
當對話框是 _continued_時呼叫,其中它是使用中的對話方塊,而使用者會以新的活動回復。 |
|
Dialog |
createChildContext(DialogContext dc)
建立內部 DialogContext。 |
|
protected
java.util.concurrent.CompletableFuture<Dialog |
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<Dialog |
onBeginDialog(DialogContext innerDc, Object options)
啟動對話框並推送至父代對話堆棧時呼叫。 |
|
protected
java.util.concurrent.CompletableFuture<Dialog |
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<Dialog |
resumeDialog(DialogContext outerDc, DialogReason reason, Object result)
當父代對話堆疊上的子對話完成這個回合時呼叫,將控制權傳回給這個對話元件。 |
| void |
setInitialDialogId(String withInitialDialogId)
設定指派給初始對話框的標識碼。 |
方法繼承來源 Dialog
方法繼承來源 DialogContainer
方法繼承來源 java.lang.Object
欄位詳細資料
PERSISTEDDIALOGSTATE
public static final String PERSISTEDDIALOGSTATE
保存對話框狀態的識別碼。
建構函式詳細資料
ComponentDialog
public ComponentDialog(String dialogId)
初始化 ComponentDialog 類別的新實例。
參數:
方法詳細資料
addDialog
public ComponentDialog addDialog(Dialog dialog)
將新的 Dialog 新增至元件對話框,並傳回更新的元件。
參數:
傳回:
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
啟動對話框並推送至父代對話堆棧時呼叫。
覆寫:
ComponentDialog.beginDialog(DialogContext outerDc, Object options)參數:
傳回:
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
當對話框是 _continued_時呼叫,其中它是使用中的對話方塊,而使用者會以新的活動回復。
覆寫:
ComponentDialog.continueDialog(DialogContext outerDc)參數:
傳回:
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)參數:
傳回:
endComponent
protected CompletableFuture
結束其父系內容中的元件對話框。
參數:
傳回:
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
對話框結束時呼叫。
覆寫:
ComponentDialog.endDialog(TurnContext turnContext, DialogInstance instance, DialogReason reason)參數:
傳回:
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
確定對話框已初始化。
參數:
傳回:
getInitialDialogId
public String getInitialDialogId()
取得指派給初始對話框的標識碼。
傳回:
onBeginDialog
protected 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
當對話框是 _continued_時呼叫,其中它是使用中的對話方塊,而使用者會以新的活動回復。
參數:
傳回:
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
對話框結束時呼叫。
參數:
傳回:
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
初始化對話框。
參數:
傳回:
onRepromptDialog
protected 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
當對話框應該重新提示使用者輸入時呼叫。
覆寫:
ComponentDialog.repromptDialog(TurnContext turnContext, DialogInstance instance)參數:
傳回:
resumeDialog
public CompletableFuture
當父代對話堆疊上的子對話完成這個回合時呼叫,將控制權傳回給這個對話元件。
覆寫:
ComponentDialog.resumeDialog(DialogContext outerDc, DialogReason reason, Object result)參數:
傳回:
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)
設定指派給初始對話框的標識碼。
參數: