Example #1
0
        public async Task <DialogTurnResult> FinishOnboardingDialog(WaterfallStepContext sc, CancellationToken cancellationToken)
        {
            _state = await _accessor.GetAsync(sc.Context);

            _state.Location = (string)sc.Result;

            await _responder.ReplyWith(sc.Context, OnboardingResponses._haveLocation, new { _state.Name, _state.Location });

            return(await sc.EndDialogAsync());
        }
        public async Task <DialogTurnResult> FinishOnboardingDialog(WaterfallStepContext sc, CancellationToken cancellationToken)
        {
            _state = await _accessor.GetAsync(sc.Context, () => new OnboardingState());

            var name = _state.Name = (string)sc.Result;
            await _accessor.SetAsync(sc.Context, _state, cancellationToken);

            await _responder.ReplyWith(sc.Context, OnboardingResponses.ResponseIds.HaveNameMessage, new { name });

            return(await sc.EndDialogAsync());
        }
Example #3
0
        public async Task <DialogTurnResult> AskForName(WaterfallStepContext sc, CancellationToken cancellationToken)
        {
            _state = await _accessor.GetAsync(sc.Context);

            if (!string.IsNullOrEmpty(_state.Name))
            {
                return(await sc.NextAsync(_state.Name));
            }
            else
            {
                return(await sc.PromptAsync(NamePrompt, new PromptOptions()
                {
                    Prompt = await _responder.RenderTemplate(sc.Context, "en", OnboardingResponses._namePrompt),
                }));
            }
        }
Example #4
0
        public async Task <DialogTurnResult> AskForLocation(WaterfallStepContext sc, CancellationToken cancellationToken)
        {
            _state = await _accessor.GetAsync(sc.Context);

            var email = _state.Email = (string)sc.Result;

            await _responder.ReplyWith(sc.Context, OnboardingResponses._haveEmail, new { email });

            if (!string.IsNullOrEmpty(_state.Location))
            {
                return(await sc.NextAsync(_state.Location));
            }
            else
            {
                return(await sc.PromptAsync(LocationPrompt, new PromptOptions()
                {
                    Prompt = await _responder.RenderTemplate(sc.Context, "en", OnboardingResponses._locationPrompt),
                }));
            }
        }