5
votes

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.

1
context.Done is not enough? - Ezequiel Jadib
But what if dialog A took me to B, took me to C. Done() gets me to B, but not to A. Or should I not worry about the stack and just forward to the dialog I want to go to? - Krumelur

1 Answers

2
votes

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.