Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pop to root dialog with bot framework?

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:

  • 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

Ideally I just want to get back to what is first on the stack without having to hardcode the RootDialog type.

like image 657
Krumelur Avatar asked Oct 29 '22 04:10

Krumelur


1 Answers

As pointed out by Ezequiel, context.Done() is how to end the current dialog, and return control to the calling dialog.

https://docs.botframework.com/.../sdkreference/dialog_stack.html

void Microsoft.Bot.Builder.Dialogs.Internals.IDialogStack.Done(R value)

Complete the current dialog and return a result to the parent dialog.

Parameters

 value: The value of the result.
like image 113
Eric Dahlvang Avatar answered Nov 15 '22 06:11

Eric Dahlvang