示例#1
0
        public MainDialog(
            BotServices services,
            ResponseManager responseManager,
            ConversationState conversationState,
            UserState userState,
            RouteDialog routeDialog,
            CancelRouteDialog cancelRouteDialog,
            FindPointOfInterestDialog findPointOfInterestDialog,
            FindParkingDialog findParkingDialog,
            IBotTelemetryClient telemetryClient)
            : base(nameof(MainDialog), telemetryClient)
        {
            _services          = services;
            _responseManager   = responseManager;
            _userState         = userState;
            _conversationState = conversationState;
            TelemetryClient    = telemetryClient;

            // Initialize state accessor
            _stateAccessor = _conversationState.CreateProperty <PointOfInterestSkillState>(nameof(PointOfInterestSkillState));

            // Register dialogs
            AddDialog(routeDialog ?? throw new ArgumentNullException(nameof(routeDialog)));
            AddDialog(cancelRouteDialog ?? throw new ArgumentNullException(nameof(cancelRouteDialog)));
            AddDialog(findPointOfInterestDialog ?? throw new ArgumentNullException(nameof(findPointOfInterestDialog)));
            AddDialog(findParkingDialog ?? throw new ArgumentNullException(nameof(findParkingDialog)));
        }
示例#2
0
        public FindPointOfInterestDialog(
            BotSettings settings,
            BotServices services,
            ResponseManager responseManager,
            ConversationState conversationState,
            RouteDialog routeDialog,
            IServiceManager serviceManager,
            IBotTelemetryClient telemetryClient,
            IHttpContextAccessor httpContext)
            : base(nameof(FindPointOfInterestDialog), settings, services, responseManager, conversationState, serviceManager, telemetryClient, httpContext)
        {
            TelemetryClient = telemetryClient;

            var checkCurrentLocation = new WaterfallStep[]
            {
                CheckForCurrentCoordinatesBeforeFindPointOfInterest,
                ConfirmCurrentLocation,
                ProcessCurrentLocationSelection,
                RouteToFindPointOfInterestDialog
            };

            var findPointOfInterest = new WaterfallStep[]
            {
                GetPointOfInterestLocations,
                ProcessPointOfInterestSelection,
                ProcessPointOfInterestAction,
            };

            // Define the conversation flow using a waterfall model.
            AddDialog(new WaterfallDialog(Actions.CheckForCurrentLocation, checkCurrentLocation)
            {
                TelemetryClient = telemetryClient
            });
            AddDialog(new WaterfallDialog(Actions.FindPointOfInterest, findPointOfInterest)
            {
                TelemetryClient = telemetryClient
            });
            AddDialog(routeDialog ?? throw new ArgumentNullException(nameof(routeDialog)));

            // Set starting dialog for component
            InitialDialogId = Actions.CheckForCurrentLocation;
        }