private async Task FillOutUserProfileAsync(ConversationFlow flow, PersonalDataRecord profile, ITurnContext turnContext, CancellationToken cancellationToken) { var input = turnContext.Activity.Text?.Trim(); string message; switch (flow.LastQuestionAsked) { case ConversationFlow.Question.None: await turnContext.SendActivityAsync("Let's get started. How tall are you?", null, null, cancellationToken); flow.LastQuestionAsked = ConversationFlow.Question.Height; break; case ConversationFlow.Question.Height: if (ValidateHeight(input, out var height, out message)) { profile.height = height; await turnContext.SendActivityAsync($"OK. Your height {profile.height} is saved.", null, null, cancellationToken); await turnContext.SendActivityAsync("What is your weight?", null, null, cancellationToken); flow.LastQuestionAsked = ConversationFlow.Question.Weight; break; } else { await turnContext.SendActivityAsync(message ?? "I'm sorry, I didn't understand that.", null, null, cancellationToken); break; }
private static async Task FillOutUserProfileAsync(ConversationFlow flow, UserProfile profile, ITurnContext turnContext) { string input = turnContext.Activity.Text?.Trim(); string message; switch (flow.lastQuestion) { case ConversationFlow.Questions.None: await turnContext.SendActivityAsync("Hey :) what's your name?"); flow.lastQuestion = ConversationFlow.Questions.Name; return; case ConversationFlow.Questions.Name: if (ValidateName(input, out string name, out message)) { profile.name = name; await turnContext.SendActivityAsync($"Hi {profile.name}."); await turnContext.SendActivityAsync($"Now, could you please tell me what day your trip was?"); flow.lastQuestion = ConversationFlow.Questions.Date; return; } else { await turnContext.SendActivityAsync($"Sorry, I didn't quite understand that..."); return; }