What you’re looking for is
await <TYPE>Context.BeginDialogAsync(nameof(<YOURDIALOGNAME>), <OPTIONAL_PARAMETERS>, cancellation token
The <TYPE>
above means you could be using waterfalls, in which case it would be stepContext
or a simple dialog, which would be dialogContext
.
so for your bot above, you’d create the PurchaseOrderDialog.cs
and SKUNumberDialog.cs
, then utilize them as follows:
if (entry)
{
JToken commandToken = JToken.Parse(turnContext.Activity.Value.ToString());
string temp = turnContext.Activity.Value.ToString();
Logger.LogInformation(temp);
string command = commandToken["action"].Value<string>();
if (command.ToLowerInvariant() == "purchaseorder")
{
return await context.BeginDialogAysnc(nameof(PurchaseOrderDialog), cancellationToken)
}
else if (command.ToLowerInvariant() == "sku")
{
return await context.BeginDialogAysnc(nameof(SKUNumberDialog), cancellationToken)
}
}
The CoreBot in the Bot Framework’s Samples Github Repo here is a good example of how complex dialogs are worked, and there’s an official how-to doc here on working with component and waterfall dialogs, which are unique to v4.
1
solved Bot Framework 4.0 Equivalent