Esempio n. 1
0
        /// <summary>Creates a new instance of this dialog set.</summary>
        /// <param name="dialogState">The dialog state property accessor to use for dialog state.</param>
        public MainDialogSet(IStatePropertyAccessor <DialogState> dialogState)
            : base(dialogState)
        {
            var greetingSteps = new WaterfallStep[]
            {
                PromtForNameAsync,
                PromtForRoomAsync,
                EndGreetingDialogAsync
            };

            Add(new TextPrompt(NamePromt, this.UserNamePromptValidatorAsync));
            Add(new ChoicePrompt(RoomPromt));
            Add(new WaterfallDialog(GreetingDialogId, greetingSteps));


            var categorySteps = new WaterfallStep[]
            {
                PromtForCategoryAsync,
                EndCategoryDialogAsync
            };

            Add(new ChoicePrompt(OrderCategoryPromt));
            Add(new WaterfallDialog(CategoryChooseDialogId, categorySteps));
        }
Esempio n. 2
0
        public ChangeEventStatusDialog(
            SkillConfigurationBase services,
            IStatePropertyAccessor <CalendarSkillState> accessor,
            IServiceManager serviceManager,
            IBotTelemetryClient telemetryClient)
            : base(nameof(ChangeEventStatusDialog), services, accessor, serviceManager, telemetryClient)
        {
            TelemetryClient = telemetryClient;

            var changeEventStatus = new WaterfallStep[]
            {
                GetAuthToken,
                AfterGetAuthToken,
                FromTokenToStartTime,
                ConfirmBeforeAction,
                ChangeEventStatus,
            };

            var updateStartTime = new WaterfallStep[]
            {
                UpdateStartTime,
                AfterUpdateStartTime,
            };

            AddDialog(new WaterfallDialog(Actions.ChangeEventStatus, changeEventStatus)
            {
                TelemetryClient = telemetryClient
            });
            AddDialog(new WaterfallDialog(Actions.UpdateStartTime, updateStartTime)
            {
                TelemetryClient = telemetryClient
            });

            // Set starting dialog for component
            InitialDialogId = Actions.ChangeEventStatus;
        }
Esempio n. 3
0
        public SearchDialog(
            BotSettings settings,
            BotServices services,
            ResponseManager responseManager,
            ConversationState conversationState,
            IBotTelemetryClient telemetryClient)
            : base(nameof(SearchDialog), settings, services, responseManager, conversationState, telemetryClient)
        {
            _stateAccessor = conversationState.CreateProperty<SkillState>(nameof(SkillState));
            _services = services;
            Settings = settings;

            var sample = new WaterfallStep[]
            {
                PromptForQuestion,
                ShowResult,
                End,
            };

            AddDialog(new WaterfallDialog(nameof(SearchDialog), sample));
            AddDialog(new TextPrompt(DialogIds.NamePrompt));

            InitialDialogId = nameof(SearchDialog);
        }
        public MainDialog(
            IServiceProvider serviceProvider,
            ResourceExplorer resourceExplorer)
            : base(nameof(MainDialog))
        {
            _services       = serviceProvider.GetService <BotServices>();
            _templateEngine = serviceProvider.GetService <LocaleTemplateManager>();

            var steps = new WaterfallStep[]
            {
                IntroStepAsync
            };

            AddDialog(new WaterfallDialog(nameof(MainDialog), steps));
            AddDialog(new TextPrompt(nameof(TextPrompt)));
            InitialDialogId = nameof(MainDialog);

            //from instructions: https://microsoft.github.io/botframework-solutions/skills/handbook/experimental-add-composer/
            var dialogResource = resourceExplorer.GetResource("Composer-With-Skill.dialog");
            var composerDialog = resourceExplorer.LoadType <AdaptiveDialog>(dialogResource);

            // Add the dialog
            AddDialog(composerDialog);
        }
Esempio n. 5
0
        public MainDialog(
            IServiceProvider serviceProvider)
            : base(nameof(MainDialog))
        {
            _services        = serviceProvider.GetService <BotServices>();
            _hotelService    = serviceProvider.GetService <IHotelService>();
            _templateManager = serviceProvider.GetService <LocaleTemplateManager>();

            // Create conversation state properties
            var conversationState = serviceProvider.GetService <ConversationState>();

            _stateAccessor = conversationState.CreateProperty <HospitalitySkillState>(nameof(HospitalitySkillState));

            var userState = serviceProvider.GetService <UserState>();

            _userStateAccessor = userState.CreateProperty <HospitalityUserSkillState>(nameof(HospitalityUserSkillState));

            var steps = new WaterfallStep[]
            {
                IntroStepAsync,
                RouteStepAsync,
                FinalStepAsync,
            };

            AddDialog(new WaterfallDialog(nameof(MainDialog), steps));
            AddDialog(new TextPrompt(nameof(TextPrompt)));
            InitialDialogId = nameof(MainDialog);

            // Register dialogs
            AddDialog(serviceProvider.GetService <CheckOutDialog>());
            AddDialog(serviceProvider.GetService <LateCheckOutDialog>());
            AddDialog(serviceProvider.GetService <ExtendStayDialog>());
            AddDialog(serviceProvider.GetService <GetReservationDialog>());
            AddDialog(serviceProvider.GetService <RequestItemDialog>());
            AddDialog(serviceProvider.GetService <RoomServiceDialog>());
        }
Esempio n. 6
0
        private void InitializeWaterfallDialog()
        {
            // Create Waterfall Steps
            var leaveApplicationSteps = new WaterfallStep[]
            {
                LeaveStartStepAsync,         // DateTimePrompt
                NumberOfDaysStepAsync,       // NumberPrompt
                OOOMessageConfirmStepAsync,  // ConfirmPrompt
                MessageDescriptionStepAsync, // TextPrompt
                MessageOptionStepAsyc,       // ChoicePrompt
                LeaveSummaryStepAsync
            };

            // Add Named Dialogs
            AddDialog(new WaterfallDialog($"{nameof(PaySlipDialog)}.mainFlow", leaveApplicationSteps));
            AddDialog(new DateTimePrompt($"{nameof(PaySlipDialog)}.leaveStart", LeaveStartValidatorAsync));
            AddDialog(new NumberPrompt <int>($"{nameof(PaySlipDialog)}.numberOfDays", LeaveDaysValidatorAsync));
            AddDialog(new ConfirmPrompt($"{nameof(PaySlipDialog)}.oofMessageConfirm"));
            AddDialog(new TextPrompt($"{nameof(PaySlipDialog)}.messageDescription"));
            AddDialog(new ChoicePrompt($"{nameof(PaySlipDialog)}.messageVisibilityOptions"));

            // Set the starting Dialog
            InitialDialogId = $"{nameof(PaySlipDialog)}.mainFlow";
        }
Esempio n. 7
0
        public UpdateEventDialog(
            ISkillConfiguration services,
            IStatePropertyAccessor <CalendarSkillState> accessor,
            IServiceManager serviceManager)
            : base(nameof(UpdateEventDialog), services, accessor, serviceManager)
        {
            var updateEvent = new WaterfallStep[]
            {
                GetAuthToken,
                AfterGetAuthToken,
                FromTokenToStartTime,
                FromEventsToNewDate,
                ConfirmBeforeUpdate,
                UpdateEventTime,
            };

            var updateStartTime = new WaterfallStep[]
            {
                UpdateStartTime,
                AfterUpdateStartTime,
            };

            var updateNewStartTime = new WaterfallStep[]
            {
                GetNewEventTime,
                AfterGetNewEventTime,
            };

            // Define the conversation flow using a waterfall model.
            AddDialog(new WaterfallDialog(Actions.UpdateEventTime, updateEvent));
            AddDialog(new WaterfallDialog(Actions.UpdateStartTime, updateStartTime));
            AddDialog(new WaterfallDialog(Actions.UpdateNewStartTime, updateNewStartTime));

            // Set starting dialog for component
            InitialDialogId = Actions.UpdateEventTime;
        }
Esempio n. 8
0
        public DeleteEventDialog(CalendarSkillServices services, CalendarSkillAccessors accessors, IServiceManager serviceManager)
            : base(Name, services, accessors, serviceManager)
        {
            var deleteEvent = new WaterfallStep[]
            {
                GetAuthToken,
                AfterGetAuthToken,
                FromTokenToStartTime,
                ConfirmBeforeDelete,
                DeleteEventByStartTime,
            };

            var updateStartTime = new WaterfallStep[]
            {
                UpdateStartTime,
                AfterUpdateStartTime,
            };

            AddDialog(new WaterfallDialog(Action.DeleteEvent, deleteEvent));
            AddDialog(new WaterfallDialog(Action.UpdateStartTime, updateStartTime));

            // Set starting dialog for component
            InitialDialogId = Action.DeleteEvent;
        }
        public UserProfileDialog(UserState userState)
            : base(nameof(UserProfileDialog))
        {
            _userProfileAccessor = userState.CreateProperty <UserProfile>("UserProfile");


            // This array defines how the Waterfall will execute.
            var waterfallSteps = new WaterfallStep[]
            {
                CpfConfirmStepAsync,
                ConsultaDebitosStepAsync,
                VerificarDividaStepAsync,
                ValorEntradaStepAsync,
                ParcelarDividaStepAsync,
                GerarContratoStepAsync,
                ContratoEnviadoStepAsync,
            };

            // Add named dialogs to the DialogSet. These names are saved in the dialog state.
            AddDialog(new WaterfallDialog(nameof(WaterfallDialog), waterfallSteps));
            AddDialog(new TextPrompt(nameof(TextPrompt)));

            AddDialog(new NumberPrompt <long>(nameof(NumberPrompt <long>), CpfCnpjPromptValidatorAsync));
            AddDialog(new TextPrompt("ValorEntrada", ValorEntradaPromptValidatorAsync));
            AddDialog(new TextPrompt("ValidarEmail", EmailPromptValidatorAsync));

            AddDialog(new ChoicePrompt(nameof(ChoicePrompt)));
            AddDialog(new ConfirmPrompt(nameof(ConfirmPrompt), null, "pt-BR"));



            //this.Dialogs.Add(Keys.Money, new Microsoft.Bot.Builder.Dialogs.NumberPrompt<int>(Culture.English, Validators.MoneyValidator));

            // The initial child Dialog to run.
            InitialDialogId = nameof(WaterfallDialog);
        }
Esempio n. 10
0
        public AddItemDialog(BotServices services,
                             IStatePropertyAccessor <OnTurnState> onTurnAccessor,
                             IStatePropertyAccessor <CartState> cartStateAccessor,
                             IPimbotServiceProvider provider)
            : base(Name)
        {
            _services          = services;
            _onTurnAccessor    = onTurnAccessor;
            _cartStateAccessor = cartStateAccessor;
            _itemService       = provider.ItemService;

            // Add dialogs
            var waterfallSteps = new WaterfallStep[]
            {
                InitializeStateStepAsync,
                PromptForCountStepAsync,
                ResolveCountAsync,
            };

            AddDialog(new WaterfallDialog(
                          "start",
                          waterfallSteps));
            AddDialog(new TextPrompt(CountPrompt, ValidateCount));
        }
Esempio n. 11
0
        void PreparePipeline()
        {
            // This array defines how the Waterfall will execute.
            var waterfallSteps = new WaterfallStep[]
            {
                ActionStep,
                ActionOptionSelected,
                GetCarImageAsync,
                CheckCarPredictionAsync,
                ConfirmStepAsync,
                SummaryStepAsync,
            };

            // Add named dialogs to the DialogSet. These names are saved in the dialog state.
            AddDialog(new WaterfallDialog(nameof(WaterfallDialog), waterfallSteps));
            AddDialog(new TextPrompt(nameof(TextPrompt)));
            AddDialog(new NumberPrompt <int>(nameof(NumberPrompt <int>), AgePromptValidatorAsync));
            AddDialog(new ChoicePrompt(nameof(ChoicePrompt)));
            AddDialog(new ConfirmPrompt(nameof(ConfirmPrompt)));
            AddDialog(new AttachmentPrompt(nameof(AttachmentPrompt)));

            // The initial child Dialog to run.
            InitialDialogId = nameof(WaterfallDialog);
        }
Esempio n. 12
0
        public Chatbot(BotServices services, ChatbotStateAccessor accessor)
        {
            _accessor = accessor ?? throw new ArgumentNullException(nameof(accessor));
            _services = services ?? throw new System.ArgumentNullException(nameof(services));
            if (!_services.LuisServices.ContainsKey(Constants.LuisKey))
            {
                throw new System.ArgumentException($"Invalid configuration. Please check your '.bot' file for a LUIS service named '{Constants.LuisKey}'.");
            }

            _dialogs = new DialogSet(_accessor.ConversationDialogState);

            // This array defines how the Waterfall will execute.
            var waterfallSteps = new WaterfallStep[]
            {
                NameStepAsync,
                AcquireNameStepAsync
            };

            // Add named dialogs to the DialogSet. These names are saved in the dialog state.
            _dialogs.Add(new WaterfallDialog("details", waterfallSteps)); //(dialogId, dialogsInThatDialogId)
            _dialogs.Add(new TextPrompt("name"));                         // (dialogId)
            _dialogs.Add(new NumberPrompt <int>("age"));
            _dialogs.Add(new ConfirmPrompt("confirm"));
        }
    public UserProfileDialog(UserState userState)
        : base(nameof(UserProfileDialog))
    {
        _userProfileAccessor = userState.CreateProperty <UserProfile>("UserProfile");
        // This array defines how the Waterfall will execute.
        var waterfallSteps = new WaterfallStep[]
        {
            TransportStepAsync,
            NameStepAsync,
            NameConfirmStepAsync,
            AgeStepAsync,
            ConfirmStepAsync,
            SummaryStepAsync,
        };

        // Add named dialogs to the DialogSet. These names are saved in the dialog state.
        AddDialog(new WaterfallDialog(nameof(WaterfallDialog), waterfallSteps));
        AddDialog(new TextPrompt(nameof(TextPrompt)));
        AddDialog(new NumberPrompt <int>(nameof(NumberPrompt <int>), AgePromptValidatorAsync));
        AddDialog(new ChoicePrompt(nameof(ChoicePrompt)));
        AddDialog(new ConfirmPrompt(nameof(ConfirmPrompt)));
        // The initial child Dialog to run.
        InitialDialogId = nameof(WaterfallDialog);
    }
Esempio n. 14
0
        public Patient() : base(nameof(Patient))
        {
            //Workaround SSL certificate issue- removes certificate validation
            clientHandler = new HttpClientHandler();
            clientHandler.ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => { return(true); };

            client             = new HttpClient(clientHandler);
            client.BaseAddress = new Uri("https://localhost:5001/api/");
            client.DefaultRequestHeaders.Accept.Clear();

            var waterfallSteps = new WaterfallStep[]
            {
                patientCard,
                patientInfo,
                rerouteBackToStart
            };

            AddDialog(new WaterfallDialog(nameof(WaterfallDialog), waterfallSteps));
            AddDialog(new TextPrompt(nameof(TextPrompt)));
            AddDialog(new TextPrompt(nameof(TextPrompt)));


            InitialDialogId = nameof(WaterfallDialog);
        }
        public OnboardingDialog(
            BotServices botServices,
            UserState userState,
            IBotTelemetryClient telemetryClient)
            : base(nameof(OnboardingDialog))
        {
            _accessor       = userState.CreateProperty <OnboardingState>(nameof(OnboardingState));
            InitialDialogId = nameof(OnboardingDialog);

            var onboarding = new WaterfallStep[]
            {
                AskForName,
                FinishOnboardingDialog,
            };

            // To capture built-in waterfall dialog telemetry, set the telemetry client
            // to the new waterfall dialog and add it to the component dialog
            TelemetryClient = telemetryClient;
            AddDialog(new WaterfallDialog(InitialDialogId, onboarding)
            {
                TelemetryClient = telemetryClient
            });
            AddDialog(new TextPrompt(DialogIds.NamePrompt));
        }
Esempio n. 16
0
        public FindStoreDialog(
            BotServices services,
            IStatePropertyAccessor <CustomerSupportTemplateState> stateAccessor,
            IBotTelemetryClient telemetryClient)
            : base(services, nameof(FindStoreDialog), telemetryClient)
        {
            _client         = new DemoServiceClient();
            _services       = services;
            _stateAccessor  = stateAccessor;
            TelemetryClient = telemetryClient;

            var findStore = new WaterfallStep[]
            {
                PromptForZipCode,
                ShowStores,
            };

            InitialDialogId = nameof(FindStoreDialog);
            AddDialog(new WaterfallDialog(InitialDialogId, findStore)
            {
                TelemetryClient = telemetryClient
            });
            AddDialog(new TextPrompt(DialogIds.ZipCodePrompt, SharedValidators.ZipCodeValidator));
        }
Esempio n. 17
0
        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        /// <param name="conversationState">The managed conversation state.</param>
        /// <param name="loggerFactory">A <see cref="ILoggerFactory"/> that is hooked to the Azure App Service provider.</param>
        /// <seealso cref="https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging/?view=aspnetcore-2.1#windows-eventlog-provider"/>

        // public dialogBotBot(ConversationState conversationState, ILoggerFactory loggerFactory)
        public dialogBotBot(dialogBotAccessors accessors, LuisRecognizer luis, QnAMaker qna)
        {
            Console.WriteLine("Bot constructor");
            // Set the _accessors
            _accessors = accessors ?? throw new ArgumentNullException(nameof(accessors));
            // The DialogSet needs a DialogState accessor, it will call it when it has a turn context.
            _dialogs = new DialogSet(accessors.ConversationDialogState);
            // This array defines how the Waterfall will execute.
            var waterfallSteps = new WaterfallStep[]
            {
                NameStepAsync,
                NameConfirmStepAsync,
            };

            // The incoming luis variable is the LUIS Recognizer we added above.
            this.Recognizer = luis ?? throw new System.ArgumentNullException(nameof(luis));

            // The incoming QnA variable is the QnAMaker we added above.
            this.QnA = qna ?? throw new System.ArgumentNullException(nameof(qna));

            // Add named dialogs to the DialogSet. These names are saved in the dialog state.
            _dialogs.Add(new WaterfallDialog("details", waterfallSteps));
            _dialogs.Add(new TextPrompt("name"));
        }
        public MainDialog(
            IServiceProvider serviceProvider)
            : base(nameof(MainDialog))
        {
            _services       = serviceProvider.GetService <BotServices>();
            _templateEngine = serviceProvider.GetService <LocaleTemplateManager>();

            var steps = new WaterfallStep[]
            {
                IntroStepAsync,
                RouteStepAsync,
                FinalStepAsync,
            };

            AddDialog(new WaterfallDialog(nameof(MainDialog), steps));
            AddDialog(new TextPrompt(nameof(TextPrompt)));
            InitialDialogId = nameof(MainDialog);

            // Register dialogs
            _sampleDialog = serviceProvider.GetService <SampleDialog>();
            _sampleAction = serviceProvider.GetService <SampleAction>();
            AddDialog(_sampleDialog);
            AddDialog(_sampleAction);
        }
Esempio n. 19
0
        public CheckItemAvailabilityDialog(
            BotServices services,
            IStatePropertyAccessor <CustomerSupportTemplateState> stateAccessor)
            : base(services, nameof(CheckItemAvailabilityDialog))
        {
            _client        = new DemoServiceClient();
            _services      = services;
            _stateAccessor = stateAccessor;

            var checkAvailability = new WaterfallStep[]
            {
                PromptForItemNumber,
                PromptForZipCode,
                ShowStores,
                PromptToHoldItem,
                HandleHoldItemResponse,
            };

            InitialDialogId = nameof(CheckItemAvailabilityDialog);
            AddDialog(new WaterfallDialog(InitialDialogId, checkAvailability));
            AddDialog(new TextPrompt(DialogIds.ItemNumberPrompt, SharedValidators.ItemNumberValidator));
            AddDialog(new TextPrompt(DialogIds.ZipCodePrompt, SharedValidators.ZipCodeValidator));
            AddDialog(new ConfirmPrompt(DialogIds.HoldItemPrompt, SharedValidators.ConfirmValidator));
        }
Esempio n. 20
0
        public SampleDialog(
            SkillConfigurationBase services,
            ResponseManager responseManager,
            IStatePropertyAccessor <SkillConversationState> conversationStateAccessor,
            IStatePropertyAccessor <SkillUserState> userStateAccessor,
            IServiceManager serviceManager,
            IBotTelemetryClient telemetryClient)
            : base(nameof(SampleDialog), services, responseManager, conversationStateAccessor, userStateAccessor, serviceManager, telemetryClient)
        {
            var sample = new WaterfallStep[]
            {
                // NOTE: Uncomment these lines to include authentication steps to this dialog
                // GetAuthToken,
                // AfterGetAuthToken,
                PromptForName,
                GreetUser,
                End,
            };

            AddDialog(new WaterfallDialog(nameof(SampleDialog), sample));
            AddDialog(new TextPrompt(DialogIds.NamePrompt));

            InitialDialogId = nameof(SampleDialog);
        }
Esempio n. 21
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PictureBot"/> class.
        /// </summary>
        /// <param name="accessors">A class containing <see cref="IStatePropertyAccessor{T}"/> used to manage state.</param>
        /// <param name="loggerFactory">A <see cref="ILoggerFactory"/> that is hooked to the Azure App Service provider.</param>
        /// <seealso cref="https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging/?view=aspnetcore-2.1#windows-eventlog-provider"/>
        public PictureBot(PictureBotAccessors accessors, LuisRecognizer luisRecognizer, ILogger <PictureBot> logger)
        {
            //On each turn, we receive an active instance of PictureBotAccessors, LuisRecognizer, and the logger
            //via dependency injection. We must also recreate the DialogSet on each turn.

            //Assign all the private variables to match the injected values
            _logger = logger;
            _logger.LogTrace("PizzaBot turn start.");
            _accessors      = accessors;
            _luisRecognizer = luisRecognizer;

            //Create a new DialogSet based on the DialogStateAccessor of the PictureBotAccessors
            _dialogs = new DialogSet(_accessors.DialogStateAccessor);

            //Add new waterfall dialogs for our "main" and "search" dialogs
            var mainDialogSteps = new WaterfallStep[]
            {
                GreetingAsync,
                MainMenuAsync
            };

            var searchDialogSteps = new WaterfallStep[]
            {
                SearchRequestAsync,
                SearchAsync,
                SearchBingAsync
            };

            _dialogs.Add(new WaterfallDialog(MAIN_DIALOG, mainDialogSteps));
            _dialogs.Add(new WaterfallDialog(SEARCH_DIALOG, searchDialogSteps));

            //Add prompts as well. Bot.Builder comes with several out of the box,
            //including TextPrompt and ConfirmPrompt
            _dialogs.Add(new TextPrompt(SEARCH_PROMPT));
            _dialogs.Add(new ConfirmPrompt(BING_PROMPT));
        }
Esempio n. 22
0
        public DeleteEventDialog(
            ISkillConfiguration services,
            IStatePropertyAccessor <CalendarSkillState> accessor,
            IServiceManager serviceManager,
            IBotTelemetryClient telemetryClient)
            : base(nameof(DeleteEventDialog), services, accessor, serviceManager, telemetryClient)
        {
            TelemetryClient = telemetryClient;

            var deleteEvent = new WaterfallStep[]
            {
                GetAuthToken,
                AfterGetAuthToken,
                FromTokenToStartTime,
                ConfirmBeforeDelete,
                DeleteEventByStartTime,
            };

            var updateStartTime = new WaterfallStep[]
            {
                UpdateStartTime,
                AfterUpdateStartTime,
            };

            AddDialog(new WaterfallDialog(Actions.DeleteEvent, deleteEvent)
            {
                TelemetryClient = telemetryClient
            });
            AddDialog(new WaterfallDialog(Actions.UpdateStartTime, updateStartTime)
            {
                TelemetryClient = telemetryClient
            });

            // Set starting dialog for component
            InitialDialogId = Actions.DeleteEvent;
        }
Esempio n. 23
0
        public SendEmailDialog(
            ISkillConfiguration services,
            IStatePropertyAccessor <EmailSkillState> emailStateAccessor,
            IStatePropertyAccessor <DialogState> dialogStateAccessor,
            IMailSkillServiceManager serviceManager)
            : base(nameof(SendEmailDialog), services, emailStateAccessor, dialogStateAccessor, serviceManager)
        {
            var sendEmail = new WaterfallStep[]
            {
                GetAuthToken,
                AfterGetAuthToken,
                CollectNameList,
                CollectRecipients,
                CollectSubject,
                CollectText,
                ConfirmBeforeSending,
                SendEmail,
            };

            // Define the conversation flow using a waterfall model.
            AddDialog(new WaterfallDialog(Actions.Send, sendEmail));
            AddDialog(new ConfirmRecipientDialog(services, emailStateAccessor, dialogStateAccessor, serviceManager));
            InitialDialogId = Actions.Send;
        }
        public RequestItemDialog(
            BotSettings settings,
            BotServices services,
            ResponseManager responseManager,
            ConversationState conversationState,
            UserState userState,
            IHotelService hotelService,
            IBotTelemetryClient telemetryClient)
            : base(nameof(RequestItemDialog), settings, services, responseManager, conversationState, userState, hotelService, telemetryClient)
        {
            var requestItem = new WaterfallStep[]
            {
                HasCheckedOut,
                ItemPrompt,
                ItemRequest,
                EndDialog
            };

            HotelService = hotelService;

            AddDialog(new WaterfallDialog(nameof(RequestItemDialog), requestItem));
            AddDialog(new TextPrompt(DialogIds.ItemPrompt, ValidateItemPrompt));
            AddDialog(new ConfirmPrompt(DialogIds.GuestServicesPrompt, ValidateGuestServicesPrompt));
        }
Esempio n. 25
0
        private void InitializeWaterfallDialog()
        {
            // Create Waterfall Steps
            var waterfallSteps = new WaterfallStep[]
            {
                StartAsync,
                MessageReceivedProjectCostQuery,
                MessageReceivedProjectCost,
                MessageReceivedPurchasePriceOfLand,
                MessageReceivedBuildingcost,
                MessageReceivedCompletioncosts,
                MessageReceivedOthercosts
            };

            // Add Named Dialogs
            AddDialog(new WaterfallDialog($"{nameof(ProjectCostDialog)}.mainFlow", waterfallSteps));
            AddDialog(new WaterfallDialog($"{nameof(ProjectCostDialog)}.Start", waterfallSteps));
            AddDialog(new TextPrompt($"{nameof(ProjectCostDialog)}.text"));
            AddDialog(new ConfirmPrompt($"{nameof(ProjectCostDialog)}.confirm"));
            AddDialog(new NumberPrompt <Decimal>($"{nameof(ProjectCostDialog)}.number"));

            // Set the starting Dialog
            InitialDialogId = $"{nameof(ProjectCostDialog)}.mainFlow";
        }
        public Dialog Configure(DialogSet dialogSet)
        {
            RegisterPrompts(dialogSet);
            var steps = new WaterfallStep[]
            {
                ConfirmStartAsync,
                PromptForAgeAsync,
                PromptForBiologicalSexAsync,
                PromptForCancerHistoryAsync,
                PromptForPsychCareHistoryAsync,
                PromptForPhysicalTherapyHistoryAsync,
                PromptForCognitiveBehavioralTherapyHistoryAsync,
                PromptForPreviousBackSurgeryHistoryAsync,
                PromptForFeverHistoryAsync,
                PromptForFecalIncontinenceHistoryAsync,
                PromptForOpioidUseAsync,
                PromptForLevelOfPainAsync,
                PromptForRaceStepAsync,
                SummaryAsync,
            };
            var waterfallDialog = new WaterfallDialog(DialogId, steps);

            return(waterfallDialog);
        }
Esempio n. 27
0
        public StartReturnDialog(
            BotServices services,
            IStatePropertyAccessor <CustomerSupportTemplateState> stateAccessor,
            IBotTelemetryClient telemetryClient)
            : base(services, nameof(StartReturnDialog), telemetryClient)
        {
            _services       = services;
            _stateAccessor  = stateAccessor;
            TelemetryClient = TelemetryClient;

            var startReturn = new WaterfallStep[]
            {
                ShowPolicy,
                PromptToEscalate,
                HandleEscalationResponse,
            };

            InitialDialogId = nameof(StartReturnDialog);
            AddDialog(new WaterfallDialog(InitialDialogId, startReturn)
            {
                TelemetryClient = telemetryClient
            });
            AddDialog(new ConfirmPrompt(DialogIds.EscalatePrompt, SharedValidators.ConfirmValidator));
        }
Esempio n. 28
0
        public ConfirmRecipientDialog(
            ISkillConfiguration services,
            IStatePropertyAccessor <EmailSkillState> emailStateAccessor,
            IStatePropertyAccessor <DialogState> dialogStateAccessor,
            IServiceManager serviceManager)
            : base(nameof(ConfirmRecipientDialog), services, emailStateAccessor, dialogStateAccessor, serviceManager)
        {
            var confirmRecipient = new WaterfallStep[]
            {
                ConfirmRecipient,
                AfterConfirmRecipient,
            };

            var updateRecipientName = new WaterfallStep[]
            {
                UpdateUserName,
                AfterUpdateUserName,
            };

            // Define the conversation flow using a waterfall model.
            AddDialog(new WaterfallDialog(Actions.ConfirmRecipient, confirmRecipient));
            AddDialog(new WaterfallDialog(Actions.UpdateRecipientName, updateRecipientName));
            InitialDialogId = Actions.ConfirmRecipient;
        }
        public ConnectToMeetingDialog(
            SkillConfigurationBase services,
            ResponseManager responseManager,
            IStatePropertyAccessor <CalendarSkillState> accessor,
            IServiceManager serviceManager,
            IBotTelemetryClient telemetryClient)
            : base(nameof(ConnectToMeetingDialog), services, responseManager, accessor, serviceManager, telemetryClient)
        {
            TelemetryClient = telemetryClient;

            var joinMeeting = new WaterfallStep[]
            {
                GetAuthToken,
                AfterGetAuthToken,
                ShowEventsSummary,
                AfterSelectEvent
            };

            var confirmNumber = new WaterfallStep[]
            {
                ConfirmNumber,
                AfterConfirmNumber
            };

            AddDialog(new WaterfallDialog(Actions.ConnectToMeeting, joinMeeting)
            {
                TelemetryClient = telemetryClient
            });
            AddDialog(new WaterfallDialog(Actions.ConfirmNumber, confirmNumber)
            {
                TelemetryClient = telemetryClient
            });

            // Set starting dialog for component
            InitialDialogId = Actions.ConnectToMeeting;
        }
Esempio n. 30
0
        public UserProfileDialog(string dialogId, UserState userState) : base(dialogId)
        {
            _userProfileAccessor = userState.CreateProperty <UserProfile>("UserProfile");

            var waterfallSteps = new WaterfallStep[]
            {
                FirstNameStep,
                LastNameStep,
                EmailStep,
                CompanyNameStep,
                ConfirmStep,
                SummaryStep
            };

            AddDialog(new WaterfallDialog(nameof(WaterfallDialog), waterfallSteps));
            AddDialog(new TextPrompt(nameof(TextPrompt)));
            AddDialog(new TextPrompt("EmailPrompt", EmailPromptValidatorAsync));
            AddDialog(new ConfirmPrompt(nameof(ConfirmPrompt))
            {
                Style = ListStyle.HeroCard
            });

            InitialDialogId = nameof(WaterfallDialog);
        }