Is exist way to change root dialog to different one during conversation:
Conversation.SendAsync((IMessageActivity)context.Activity, () => new RootDialogA())
We have application where it start with one rootdialog and on some point we want to run another root dialog:
Conversation.SendAsync((IMessageActivity)context.Activity, () => new RootDialogB())
Yes there is. Using context.Call() or context.Forward() you can switch between dialogs. Please take a look at this sample project
Generally what people do is have a root dialog that routes to another dialog based on the context of the conversation. Here is an example from the sample I think where the root dialog is routing to another dialog using the context.Call() method:
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);
}
You must provide a resume after method that fires off when the called dialog has completed. In the sample it looks like this:
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);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With