Ejemplo n.º 1
0
        /// <summary>
        /// Asks the user to select question/answer.
        /// </summary>
        /// <param name="stepContext"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        private async Task <DialogTurnResult> AskSelectEventStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            var _DialogInfo = await _dialogInfoStateProperty.GetAsync(stepContext.Context);

            _DialogInfo.LastDialogName = this.Id;

            _events = DecisionMaker.GetPlannedEvents(_DialogInfo.Language);

            var choices = new List <Choice>();

            foreach (var q in _events.Keys)
            {
                choices.Add(new Choice(q));
            }
            var dialogsMUI = DecisionMaker.GetDialogsMui(_DialogInfo.Language);
            var prompt     = dialogsMUI.PlannedEventsDictionary["prompt"];// Choose a question:

            var options = new PromptOptions()
            {
                Prompt      = MessageFactory.Text(prompt),
                Choices     = choices,
                RetryPrompt = MessageFactory.Text(dialogsMUI.MainDictionary["reprompt"]), // Try one more time, please
                Style       = ListStyle.SuggestedAction
            };

            var message = options.Prompt.Text;
            var sender  = "bot";
            var time    = stepContext.Context.Activity.Timestamp.Value;

            _myLogger.LogMessage(message, sender, time, _DialogInfo.DialogId);

            return(await stepContext.PromptAsync(nameof(ChoicePrompt), options, cancellationToken));
        }