是的。使用context.Call()
或context.Forward()
可以在對話框之間切換。請看this sample project
通常人們做的是根對話的上下文根路徑到另一個對話。下面是我認爲根源在哪裏對話框使用context.Call()
方法路由到另一個對話框樣品的例子:
private async Task SendWelcomeMessageAsync(IDialogContext context)
{
await context.PostAsync("Hi, I'm the Basic Multi Dialog bot. Let's get started.");
context.Call(new NameDialog(), this.NameDialogResumeAfter);
}
您必須提供當被叫對話已完成了關閉觸發方法後,一份簡歷。在樣本它看起來像這樣:
private async Task NameDialogResumeAfter(IDialogContext context, IAwaitable<string> result)
{
try
{
this.name = await result;
context.Call(new AgeDialog(this.name), this.AgeDialogResumeAfter);
}
catch (TooManyAttemptsException)
{
await context.PostAsync("I'm sorry, I'm having issues understanding you. Let's try again.");
await this.SendWelcomeMessageAsync(context);
}
}
[微軟BOT框架處理多個對話]的可能的複製(https://stackoverflow.com/questions/37169371/handling-multiple-dialogs-in-microsoft-bot -framework) –