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
- Change MainDialog to derive from
ActivityHandlerDialog
- Rename
RouteAsync
method toOnMessageActivityAsync
- Remove this line:
var turnResult = EndOfTurn;
- Remove this code block:
if (turnResult != EndOfTurn) { await CompleteAsync(dc); }
- Remove this line:
- Rename
OnEventAsync
toOnEventActivityAsync
- In
OnCancel
- Remove the following:
await CompleteAsync(dc); await dc.CancelAllDialogsAsync();
- Change interruption action to
InterruptionAction.End
- Remove the following:
- In
OnHelp
- Change interruption action to
InterruptionAction.Resume
- Change interruption action to
- In
OnLogout
- Change interruption action to
InterruptionAction.End
- Change interruption action to
-
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)); }
- Rename CompleteAsync to OnDialogComleteAsync and change DialogTurnResult to object.