Example #1
0
        private async Task <DialogTurnResult> ShowConditions(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            // Get state from options and save. If null, save anyway so dictionary calls won't have to check if key exists.
            MainDiagState state = (MainDiagState)stepContext.Options;

            stepContext.Values.Add(BotConstants.STEP_VALUES_MAIN_STATE_KEY, state);

            if (state == null || !state.AcceptedConditions)
            {
                // Send adaptive card with disclaimer
                var adaptiveCard           = CardGenerator.GetDisclaimerCard();
                var adaptiveCardAttachment = new Attachment()
                {
                    ContentType = "application/vnd.microsoft.card.adaptive",
                    Content     = adaptiveCard,
                };
                var promptMessageSummary = MessageFactory.Attachment(adaptiveCardAttachment, "Hi! I'm BastardBot. Before we begin...");
                await stepContext.Context.SendActivityAsync(promptMessageSummary, cancellationToken);

                // Check S'all Good, Man
                string msg           = $"All good?";
                var    promptMessage = MessageFactory.Text(msg, msg, InputHints.ExpectingInput);
                return(await stepContext.PromptAsync(nameof(ChoicePrompt), new PromptOptions
                {
                    Prompt = promptMessage,
                    Choices = new List <Choice>
                    {
                        new Choice {
                            Value = BotConstants.CHOICE_SAUL_GOODMAN
                        },
                        new Choice {
                            Value = "I'm not Sure"
                        }
                    }
                }, cancellationToken));
            }
            else
            {
                // Not first time around. Skip disclaimer steps
                return(await stepContext.NextAsync(new Choice(BotConstants.CHOICE_SAUL_GOODMAN), cancellationToken));
            }
        }