Exemplo n.º 1
0
        public async Task <DialogTurnResult> FinishImmigrationDialog(WaterfallStepContext sc, CancellationToken cancellationToken)
        {
            _state = await _accessor.GetAsync(sc.Context);

            _state.LegalContactResponse = (string)sc.Result;

            await _responder.ReplyWith(sc.Context, ImmigrationResponses.ResponseIds.HaveTravelMessage, new { _state.ActionType, _state.LegalContactResponse });

            //sc = null;
            await sc.CancelAllDialogsAsync(cancellationToken);

            return(await sc.EndDialogAsync());

            //return await sc.BeginDialogAsync(MainResponses.ResponseIds.Completed);
        }
Exemplo n.º 2
0
        public async Task <DialogTurnResult> AskForAction(WaterfallStepContext sc, CancellationToken cancellationToken)
        {
            _state = await _accessor.GetAsync(sc.Context, () => new ImmigrationState());

            if (!string.IsNullOrEmpty(_state.ActionType))
            {
                return(await sc.NextAsync(_state.ActionType));
            }
            else
            {
                return(await sc.PromptAsync(DialogIds.AskForAction, new PromptOptions
                {
                    Prompt = await _responder.RenderTemplate(sc.Context, sc.Context.Activity.Locale, ImmigrationResponses.ResponseIds.AskForAction)
                }));
            }
        }
Exemplo n.º 3
0
        public async Task <DialogTurnResult> AskForContactLegalAttorney(WaterfallStepContext sc, CancellationToken cancellationToken)
        {
            _state = await _accessor.GetAsync(sc.Context, () => new ImmigrationState());

            var travel = _state.LegalContactResponse = (string)sc.Result;

            if (travel.ToLower().Contains("yes"))
            {
                await _responder.ReplyWith(sc.Context, ImmigrationResponses.ResponseIds.HaveLegalMessage, new { travel });
            }

            return(await sc.ContinueDialogAsync());

            //return await sc.PromptAsync(DialogIds.AskForContactLegalAttorney, new PromptOptions()
            //{
            //    Prompt = await _responder.RenderTemplate(sc.Context, sc.Context.Activity.Locale, ImmigrationResponses.ResponseIds.AskForContactLegalAttorney),
            //});
        }
Exemplo n.º 4
0
        public async Task <DialogTurnResult> AskForTravel(WaterfallStepContext sc, CancellationToken cancellationToken)
        {
            _state = await _accessor.GetAsync(sc.Context, () => new ImmigrationState());

            var action = _state.ActionType = (string)sc.Result;

            // string[] countries = {"United States", "US", "UnitedStates","USA", "United States of America"};
            // || (countries.Any(action.Contains)

            if (action.Contains("documents"))
            {
                await _responder.ReplyWith(sc.Context, ImmigrationResponses.ResponseIds.HaveTravelOutsideUSMessage,
                                           new { action });
            }

            return(await sc.PromptAsync(DialogIds.AskForTravel, new PromptOptions()
            {
                Prompt = await _responder.RenderTemplate(sc.Context, sc.Context.Activity.Locale, ImmigrationResponses.ResponseIds.AskForContactLegalAttorney),
            }));
        }