private async Task OnConfirmBooking(IDialogContext context, IAwaitable <string> result) { try { string optionSelected = await result; if (optionSelected == "Yes") { string accessToken = context.PrivateConversationData.GetValue <string>(AccessTokenDataKey); MeetingRequestInput meetingData = context.ConversationData.GetValue <MeetingRequestInput>(MeetingDataKey); MeetingSlot slot = context.ConversationData.GetValue <MeetingSlot>(ChosenSlotKey); ICalendarOperations ico = ServiceLocator.GetCalendarOperations(); var results = await ico.MakeAppointment(meetingData, slot, accessToken); await context.PostAsync(results); } else { await context.PostAsync("OK, booking cancelled"); } context.Done <object>(null); } catch (TooManyAttemptsException ex) { string fullError = ex.ToString(); Trace.TraceError(fullError); await context.PostAsync($"Sorry, I don't understand."); context.Done(true); } }
private async Task ResumeAfterMeetingRequestInputForm(IDialogContext context, IAwaitable <MeetingRequestInput> result) { // Let's figure out what's missing and ask the user. string accessToken = context.PrivateConversationData.GetValue <string>(AccessTokenDataKey); MeetingRequestInput meetingData = await result; ICalendarOperations ico = ServiceLocator.GetCalendarOperations(); Dictionary <string, MeetingSlot> possibleTimes = await ico.FindMeetingTimes(meetingData, accessToken); context.ConversationData.SetValue(PossibleTimesKey, possibleTimes); context.ConversationData.SetValue(MeetingDataKey, meetingData); PromptDialog.Choice(context, this.OnPickMeetingTime, possibleTimes.Keys.ToArray(), "Please pick a meeting time:", "Invalid Choice", 2); }