如何使用Bot框架弹出根对话框? [英] How to pop to root dialog with bot framework?
问题描述
我正在基于bot框架为我的bot使用.Net后端. 在我的一个对话框中,我为用户提供了返回根对话框的选项-至少,这是我正在尝试执行的操作,但没有成功.这是我已经尝试过的:
I'm using the .Net backend for my bot based on the bot framework. In one of my dialogs I give the user the option to return to the root dialog - or at least, that's what I'm trying to do but no success. Here's what I have already tried:
- 致电
context.Reset()
-我了解到我可能无法在对话框中使用它;它会导致崩溃 -
Conversation.SendAsync((IMessageActivity)context.Activity, () => new RootDialog())
-似乎什么也没做
- call
context.Reset()
- I learned that I may not use this from inside a dialog; it causes a crash Conversation.SendAsync((IMessageActivity)context.Activity, () => new RootDialog())
- does not seem to do anything
理想情况下,我只想回到堆栈的第一位,而不必对RootDialog
类型进行硬编码.
Ideally I just want to get back to what is first on the stack without having to hardcode the RootDialog
type.
推荐答案
正如Ezequiel所指出的,context.Done()是如何结束当前对话框并将控件返回到调用对话框的方法.
As pointed out by Ezequiel, context.Done() is how to end the current dialog, and return control to the calling dialog.
://relreferrofofer .botframework.com/.../sdkreference/dialog_stack.html
void Microsoft.Bot.Builder.Dialogs.Internals.IDialogStack.Done(R值)
void Microsoft.Bot.Builder.Dialogs.Internals.IDialogStack.Done(R value)
完成当前对话框,然后将结果返回到父对话框.
Complete the current dialog and return a result to the parent dialog.
参数
value: The value of the result.
这篇关于如何使用Bot框架弹出根对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!