private async Task ResumeFlightSearchAfterHandler(IDialogContext context, IAwaitable <FlightSearchFormBasic> result) { var searchQuery = await result; var flights = FlightManager.Flights(searchQuery); var response = context.MakeMessage(); response.AttachmentLayout = AttachmentLayoutTypes.Carousel; response.Attachments = AdaptiveCardManager.GetFlightsAdaptiveCards(flights); await context.PostAsync(response); context.Done <object>(null); }
private async Task ResumeAfterFlightsFormDialog(IDialogContext context, IAwaitable <FlightSearchFormBasic> result) { try { var searchQuery = await result; var flights = FlightManager.Flights(searchQuery); await context.PostAsync($"I found in total {flights.Count()} flights matching your search criteria:"); var resultMessage = context.MakeMessage(); resultMessage.AttachmentLayout = AttachmentLayoutTypes.Carousel; resultMessage.Attachments = new List <Attachment>(); resultMessage.Attachments = AdaptiveCardManager.GetFlightsAdaptiveCards(flights).ToList(); await context.PostAsync(resultMessage); } catch (FormCanceledException ex) { string reply; if (ex.InnerException == null) { reply = "You have canceled the operation. Quitting from the Flights Search"; } else { reply = $"Oops! Something went wrong :( Technical Details: {ex.InnerException.Message}"; } await context.PostAsync(reply); } finally { context.Done <object>(null); } }