This site is obsolete and should be used for reference only. The information in this documentation is not guaranteed to work for Bot Framework SDK versions past 4.9.1.

Beta Release 0.7

Migrating to ActivityHandlerDialog

Step-by-step instructions for migrating a dialog from RouterDialog to ActivityHandlerDialog

Instructions

  1. Change MainDialog to derive from ActivityHandlerDialog
  2. Rename RouteAsync method to OnMessageActivityAsync
    • Remove this line:
        var turnResult = EndOfTurn;
      
    • Remove this code block:
        if (turnResult != EndOfTurn)
        {
            await CompleteAsync(dc);
        }
      
  3. Rename OnEventAsync to OnEventActivityAsync
  4. In OnCancel
    • Remove the following:
        await CompleteAsync(dc);
        await dc.CancelAllDialogsAsync();
      
    • Change interruption action to InterruptionAction.End
  5. In OnHelp
    • Change interruption action to InterruptionAction.Resume
  6. In OnLogout
    • Change interruption action to InterruptionAction.End
  7. Replace OnStartAsync with the following:

     // Runs when the dialog stack is empty, and a new member is added to the conversation. Can be used to send an introduction activity.
     protected override async Task OnMembersAddedAsync(DialogContext innerDc, CancellationToken cancellationToken = default)
     {
         await innerDc.Context.SendActivityAsync(_responseManager.GetResponse(MainResponses.WelcomeMessage));
     }
    
  8. Rename CompleteAsync to OnDialogComleteAsync and change DialogTurnResult to object.