Manage a long-running operation How-To

Copper Contributor

I have been working through the "Manage a long-running operation" How-To but have hit a brick wall.  I strongly suspect this is because I am being a bit thick and missing something obvious, however at the end of the instructions it simply says "Start the Emulator, connect to your bot, and send messages as shown below.", but it is not clear to me exactly what this means.

 

The messages it mentions start with a "Please select a long test operation option" adaptive card, however this is produced by the bot in response to a Event Activity.  How do I produce this activity in the emulator?  Am I meant to be interacting with the bot using another tool? 

 

Any ideas?

1 Reply

I have one solution, but I don't know if it is the correct approach: if I add an override of OnMessageActivityAsync(), I can then trigger the dialog:

 

protected override async Task OnMessageActivityAsync(ITurnContext<IMessageActivity> turnContext, CancellationToken cancellationToken)
{
Logger.LogInformation("Running dialog with Message Activity.");

// Run the Dialog with the new message Activity.
await Dialog.RunAsync(turnContext, ConversationState.CreateProperty<DialogState>(nameof(DialogState)), cancellationToken);
}

 

I'm guessing this wasn't the solution intended by the author of the How-To, since they don't include that override in the example code, but at least it moves me forward for now...