Exemplo n.º 1
0
        public ExistedComputerDialogComponent(string dialogId, IPersonStateManager personStateManager, IDbContext dbContext, string menuItemOptionText) : base(dialogId)
        {
            _dbContext         = dbContext;
            MenuItemOptionText = menuItemOptionText ?? dialogId;
            AddDialog(new WaterfallDialog(MAIN_WATERFALL)
                      .AddStep(DecideIfNewOrExistUser.Step(dbContext, PERSONAL_DATA_DIALOG))
                      .AddStep(RequestForScanId)
                      .AddStep(HandleScanIdResult));

            AddDialog(new PersonalDataDialogComponent(PERSONAL_DATA_DIALOG, personStateManager, dbContext));

            AddDialog(new TextPrompt(SCAN_ID_PROMPT, Validator));
        }
Exemplo n.º 2
0
        public NewComputerDialogComponent(string dialogId, IPersonStateManager accessors, IDbContext dbContext,
                                          IRecommender recommender,
                                          string menuItemOptionText = null)
            : base(dialogId)
        {
            _dbContext         = dbContext;
            _accessors         = accessors;
            _recommender       = recommender;
            MenuItemOptionText = menuItemOptionText ?? dialogId;

            AddDialog(new WaterfallDialog(MAIN_WATERFALL)
                      .AddStep(DecideIfNewOrExistUser.Step(_dbContext, NEW_USER_DIALOG))
                      .AddStep(GetComputerRecommendations));

            AddDialog(new PersonalDataDialogComponent(NEW_USER_DIALOG, _accessors, _dbContext));
        }
Exemplo n.º 3
0
        public PersonalDataDialogComponent([Localizable(false)] string dialogId, IPersonStateManager personStateManager,
                                           IDbContext dbContext, string menuItemOptionText = null) : base(dialogId)
        {
            MenuItemOptionText  = menuItemOptionText ?? dialogId;
            _personStateManager = personStateManager;
            _dbContext          = dbContext;
            _workPrompt         =
                new WorkTextPrompt(WORK_TEXT_DIALOG, menuItemOptionText: BotStrings.Change_your_work,
                                   suggestedActions: _dbContext.GetOrderedWorkList().Take(5), handleResult: HandleWork);
            _agePrompt.HandleResult    = HandleAge;
            _genderPrompt.HandleResult = HandleGender;

            AddDialog(new WaterfallDialog(WELCOME_WATERFALL)
                      .AddStep(DecideIfNewOrExistUser.Step(dbContext, NEW_USER_WATERFALL, EXIST_USER_MENU))
                      .AddStep(SaveDetailsStep)
                      );

            AddDialog(new WaterfallDialog(NEW_USER_WATERFALL)
                      .AddStep(HandlePersonalDataStep)
                      .AddStep(_genderPrompt.PromptAsync)
                      .AddStep(HandleGenderStep)
                      .AddStep(_agePrompt.PromptAsync)
                      .AddStep(HandleAgeStep)
                      .AddStep(_workPrompt.PromptAsync)
                      .AddStep(HandleWorkStep)
                      .AddStep(EndWaterfallStep)
                      );

            AddDialog(new MenuDialogComponent(EXIST_USER_MENU, BotStrings.Select_which_data_you_want_to_change,
                                              new List <IMenuItemDialog>
            {
                _genderPrompt,
                _agePrompt,
                _workPrompt
            }));

            AddDialog(_genderPrompt);
            AddDialog(_agePrompt);
            AddDialog(_workPrompt);
        }