IDialogContext.Forward导致对话框在MS Bot框架中出现一条消息后退出 [英] IDialogContext.Forward causes the dialog to quit after one message in MS bot framework

查看:91
本文介绍了IDialogContext.Forward导致对话框在MS Bot框架中出现一条消息后退出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用MS Bot框架,并尝试将对话从一个对话框重定向到另一个对话框.如果我使用context.Call,则新调用的对话框将等待用户首先输入任何消息,这是不希望的.因此,我想立即启动新对话框.我正在使用context.Forward,它调用FormDialog的一个实例,但是新创建的对话框输出第一条消息,然后整个对话框堆栈结束,将我返回到机器人的主屏幕.

I am using MS bot framework and trying to redirect the conversation from one dialog to another. If I use context.Call, the newly called dialog waits for the user to input any message first, which is undesirable. So I want to immediately start the new dialog. I am using context.Forward, which calls an instance of a FormDialog, but the newly created dialog outputs the first message, and then the whole dialog stack ends, returning me to the main screen of my bot.

await context.Forward<TestDialogForm, object>(
                TestDialog.GetDialog(), ChildTestDialogCompleted,
                string.Empty, CancellationToken.None);

我做错了什么? context.Call()在同一个对话框中可以正常工作.

What am I doing wrong? context.Call() works fine with the same dialog.

推荐答案

请参阅: 通过对话框调用表单

这对我有用:

await context.Forward(
                new TestDialogForm(), 
                ChildTestDialogCompleted, 
                message, 
                System.Threading.CancellationToken.None);

这篇关于IDialogContext.Forward导致对话框在MS Bot框架中出现一条消息后退出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆