private async Task WorkshopPrompt(DialogContext dc, IDictionary <string, object> args, SkipStepFunction next) { var choiceResult = args as ChoiceResult; if (choiceResult != null) { dc.ActiveDialog.State["ticketType"] = choiceResult.Value.Value; await dc.Context.SendActivity("you picked: " + choiceResult.Value.Value); } var choices = new List <Choice>(); choices.Add(new Choice { Value = "Get Started Building a Web Application with ASP.NET Core", Synonyms = new List <string> { "asp.net", "asp.net core", "core", "web" } }); choices.Add(new Choice { Value = "DevOps with Visual Studio Team Services (VSTS)", Synonyms = new List <string> { "VSTS", "devops", "team services" } }); choices.Add(new Choice { Value = "Azure for Developers", Synonyms = new List <string> { "azure", "azure for dev" } }); choices.Add(new Choice { Value = "Deploying Multi-OS applications with Docker EE", Synonyms = new List <string> { "docker", "docker ee" } }); await dc.Prompt("pickList", "Which workshop would you like to attend?", new ChoicePromptOptions() { Choices = choices }); }
private async Task SpeakerConfirmStep(DialogContext dc, IDictionary <string, object> args, SkipStepFunction next) { if (args.Keys.Contains("Value")) { dc.ActiveDialog.State["speakerInput"] = args["Value"]; } var speakers = _sessionService.GetSpeakerNames(dc.ActiveDialog.State["speakerInput"].ToString()); var choices = new List <Choice>(); foreach (var speaker in speakers.OrderBy(s => s)) { choices.Add(new Choice { Value = speaker }); } await dc.Prompt("pickList", "Please confirm the speaker choice:", new ChoicePromptOptions() { Choices = choices }); }
private async Task BookingRoomDuration(DialogContext dialogContext, object args, SkipStepFunction next) { var state = new TechClubAssistantBotState(dialogContext.ActiveDialog.State); dialogContext.ActiveDialog.State = state; if (args is Microsoft.Bot.Builder.Prompts.DateTimeResult result) { state.Time = result.Text; } if (String.IsNullOrEmpty(state.Duration)) { await dialogContext.Prompt(DurationPrompt, "Enter duration: ", new PromptOptions() { RetryPromptString = "Please enter correct duration" }); } else { await dialogContext.Continue(); } }
private async Task SessionStep(DialogContext dc, IDictionary <string, object> args, SkipStepFunction next) { // get speaker name and look up sessions var choiceResult = args as ChoiceResult; dc.ActiveDialog.State["speakerName"] = choiceResult.Value.Value; var sessions = _sessionService.GetSessions(choiceResult.Value.Value); var choices = new List <Choice>(); foreach (var session in sessions.OrderBy(s => s.Title)) { choices.Add(new Choice { Value = session.Title }); } await dc.Prompt("pickList", "Which session would you like to evaluate? ", new ChoicePromptOptions() { Choices = choices }); }
private async Task BookingRoomTime(DialogContext dialogContext, object args, SkipStepFunction next) { var state = new TechClubAssistantBotState(dialogContext.ActiveDialog.State); dialogContext.ActiveDialog.State = state; if (args is Microsoft.Bot.Builder.Prompts.ChoiceResult choiceResult) { state.MeetingRoom = choiceResult.Value.Value; } if (String.IsNullOrEmpty(state.Time)) { await dialogContext.Prompt(TimePrompt, "Enter date and time: ", new PromptOptions() { RetryPromptString = "Please enter correct date and time" }); } else { await dialogContext.Continue(); } }
private async Task UploadPhotos(DialogContext dialogContext, object result, SkipStepFunction next) { Stream urlToStream(string url) { byte[] imageData = null; using (var wc = new System.Net.WebClient()) imageData = wc.DownloadData(url); return new MemoryStream(imageData); } var context = dialogContext.Context; var state = context.GetConversationState<BotState>(); if (state.ImgUrls.Count >= MinPhoto) { await next(); return; } foreach (var attachment in dialogContext.Context.Activity.Attachments) { var url = await StorageProvider.Load(urlToStream(attachment.ContentUrl), attachment.Name); state.AddImgUrl(url.ToString()); } Thread.Sleep(1000); if (state.ImgUrls.Count >= MinPhoto) { await next(); return; } await dialogContext.Prompt(PromptStep.PhotoPrompt, $"Прикрепи еще фото (осталось {MinPhoto - state.ImgUrls.Count})."); }
private static async Task AskNameStep(DialogContext dialogContext, object result, SkipStepFunction next) { await dialogContext.Prompt(AskNamePrompt, "May I know your good name?"); }
private async Task FeedbackStep(DialogContext dc, IDictionary <string, object> args, SkipStepFunction next) { await dc.Prompt("text", "Please provide a comment to the speaker.", new PromptOptions { RetryPromptString = "Please type your comment." }); }
private async Task AskPhotoStep(DialogContext dialogContext, object result, SkipStepFunction next) { var state = dialogContext.Context.GetConversationState<BotState>(); state.Group = (result as TextResult).Value.Trim(); await dialogContext.Prompt(PromptStep.PhotoPrompt, $"Прикрепи {MinPhoto} фотографии, на которых только ты."); }
private async Task AskGroupStep(DialogContext dialogContext, object result, SkipStepFunction next) { var state = dialogContext.Context.GetConversationState<BotState>(); state.Name = (result as TextResult).Value; await dialogContext.Prompt(PromptStep.NamePrompt, "Напиши номер группы:"); }
private async Task AskNameStep(DialogContext dialogContext, object result, SkipStepFunction next) { await dialogContext.Prompt(PromptStep.NamePrompt, "Напиши ФИО:"); }
private static async Task Waterfall2_Step1(DialogContext dc, object args, SkipStepFunction next) { await dc.Context.SendActivity("step1"); await dc.Prompt("number", "Enter a number.", new PromptOptions { RetryPromptString = "It must be a number" }); }
private async Task GetNameTask(DialogContext dialogContext, object result, SkipStepFunction next) { await dialogContext.Prompt(Constants.DialogSteps.NameStep.ToString(), "Hi User.May I please know your name?"); }
private static Task SearchStepContinent(DialogContext dc, IDictionary <string, object> args, SkipStepFunction next) { return(dc.Prompt("ContinentPrompt", "Pour vous proposer une destination, je dois vous poser quelques questions. Tout d'abord, sur quel continent aimeriez-vous aller ?")); }
private async Task QuantityPrompt(DialogContext dc, IDictionary <string, object> args, SkipStepFunction next) { dc.ActiveDialog.State = new Dictionary <string, object>(); await dc.Prompt("number", "How many tickets would you like?", new PromptOptions { RetryPromptString = "Please provide a number" }); }
private async Task AskNameStep(DialogContext dialogContext, object result, SkipStepFunction next) { await dialogContext.Prompt(PromptStep.NamePrompt, "What is your name?"); }
private Task ChoiceCardStep(DialogContext dialogContext, object result, SkipStepFunction next) { return(dialogContext.Prompt(CARD_PROMPT_ID, "Let us further assist you. Please choose an option below\n", cardOptions)); }
private async Task AskTokenStep(DialogContext dialogContext, object result, SkipStepFunction next) { await dialogContext.Prompt(PromptStep.TokenPrompt, "Введите ключ регистрации:"); }
private static Task LoadBagStepStart(DialogContext dc, IDictionary <string, object> args, SkipStepFunction next) { return(dc.Prompt("LoadBagPrompt", "J'attend votre ordre pour que BRAIN charge votre valise dans le coffre de votre voiture")); }
private Task ChoiceCardStep(DialogContext dialogContext, object result, SkipStepFunction next) { return(dialogContext.Prompt("cardPrompt", "Which card would you like to choose?", cardOptions)); }
private async Task NonePrompt(DialogContext dc, IDictionary <string, object> args, SkipStepFunction next) { await Respond(dc, args); await dc.Prompt("none", "What kind of Pizza would you like? (none)", _choicePromptOptions); }