Exemple #1
0
        private async Task <DialogTurnResult> NameStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            // Find the matching game to play and set up our state
            ScoreState ss = stepContext.SetStateAs(new ScoreState(_pdata.GetGameData(stepContext.GetResultAs <FoundChoice>().ToLowerCaseTrimmedString())));

            return(await stepContext.BuildTextPrompt($"Great, let's play {ss.CurrentGame.GameName}, Please enter your name to begin.", cancellationToken));
        }
Exemple #2
0
        private async Task <DialogTurnResult> AskQuestionDialogStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            // Read in the passed down values from the parent dialog
            ScoreState ss = stepContext.SetStateAs(stepContext.GetOptionsAs <ScoreState>());

            await stepContext.Context.SendTextActivity(
                $"Question {ss.GetCurrentPositionGame() + 1} coming up");

            await Task.Delay(2500);

            switch (ss.CurrentGame.GameType)
            {
            case "Maths":

                return(await stepContext.BuildNumberPrompt(ss.GetCurrentQuestion(), cancellationToken));

            case "Phonics":

                return(await stepContext.BuildTextPrompt(ss.GetCurrentQuestion(), cancellationToken));
            }

            return(await stepContext.BuildTextPrompt("Something went wrong here, you don't seem to be following one of our standard games", cancellationToken));
        }