private async Task OnOptionSelected(DialogContext context, IMessageActivity result) { try { if (result.Text.ToLower().Contains("help") || result.Text.ToLower().Contains("support") || result.Text.ToLower().Contains("problem")) { await context.Forward <int>(new SupportDialog(), this.ResumeAfterSupportDialog, result, CancellationToken.None); return; } var optionSelected = result; switch (optionSelected.Text) { case FlightsOption: context.Call <object>(new FlightsDialog(), this.ResumeAfterOptionDialog); break; case HotelsOption: context.Call <object>(new HotelsDialog(), this.ResumeAfterOptionDialog); break; } } catch (TooManyAttemptsException ex) { await context.PostAsync($"Ooops! Too many attempts :(. But don't worry, I'm handling that exception and you can try again!"); context.Wait(this.MessageReceivedAsync); } }
//public override Task<DialogTurnResult> ContinueDialogAsync(DialogContext outerDc, CancellationToken cancellationToken = default(CancellationToken)) //{ // return base.ContinueDialogAsync(outerDc, cancellationToken); //} //public override Task<DialogTurnResult> ResumeDialogAsync(DialogContext outerDc, DialogReason reason, object result = null, CancellationToken cancellationToken = default(CancellationToken)) //{ // return base.ResumeDialogAsync(outerDc, reason, result, cancellationToken); //} public virtual async Task MessageReceivedAsync(DialogContext context, IMessageActivity result) { var message = result; if (message.Text.ToLower().Contains("help") || message.Text.ToLower().Contains("support") || message.Text.ToLower().Contains("problem")) { await context.Forward <int>(new SupportDialog(), this.ResumeAfterSupportDialog, message, CancellationToken.None); } else { await this.ShowOptions(context); } }