示例#1
0
        public MainDialog(
            ISkillConfiguration services,
            ConversationState conversationState,
            UserState userState,
            IBotTelemetryClient telemetryClient,
            ITaskService serviceManager,
            IMailService mailService,
            bool skillMode)
            : base(nameof(MainDialog), telemetryClient)
        {
            _skillMode         = skillMode;
            _services          = services;
            _conversationState = conversationState;
            _userState         = userState;
            _serviceManager    = serviceManager;
            _mailService       = mailService;
            TelemetryClient    = telemetryClient;

            // Initialize state accessor
            _toDoStateAccessor = _conversationState.CreateProperty <ToDoSkillState>(nameof(ToDoSkillState));
            _userStateAccessor = _userState.CreateProperty <ToDoSkillUserState>(nameof(ToDoSkillUserState));

            // RegisterDialogs
            RegisterDialogs();
        }
示例#2
0
        public MarkToDoItemDialog(
            ISkillConfiguration services,
            IStatePropertyAccessor <ToDoSkillState> accessor,
            ITaskService serviceManager)
            : base(nameof(MarkToDoItemDialog), services, accessor, serviceManager)
        {
            var markToDoTask = new WaterfallStep[]
            {
                GetAuthToken,
                AfterGetAuthToken,
                ClearContext,
                InitAllTasks,
                CollectToDoTaskIndex,
                this.MarkToDoTaskCompleted,
            };

            var collectToDoTaskIndex = new WaterfallStep[]
            {
                AskToDoTaskIndex,
                AfterAskToDoTaskIndex,
            };

            // Define the conversation flow using a waterfall model.
            AddDialog(new WaterfallDialog(Action.MarkToDoTaskCompleted, markToDoTask));
            AddDialog(new WaterfallDialog(Action.CollectToDoTaskIndex, collectToDoTaskIndex));

            // Set starting dialog for component
            InitialDialogId = Action.MarkToDoTaskCompleted;
        }
示例#3
0
        public DeleteEmailDialog(
            ISkillConfiguration services,
            IStatePropertyAccessor <EmailSkillState> emailStateAccessor,
            IStatePropertyAccessor <DialogState> dialogStateAccessor,
            IServiceManager serviceManager)
            : base(nameof(DeleteEmailDialog), services, emailStateAccessor, dialogStateAccessor, serviceManager)
        {
            var deleteEmail = new WaterfallStep[]
            {
                IfClearContextStep,
                GetAuthToken,
                AfterGetAuthToken,
                CollectSelectedEmail,
                PromptToDelete,
                DeleteEmail,
            };

            var showEmail = new WaterfallStep[]
            {
                ShowEmails,
            };

            var updateSelectMessage = new WaterfallStep[]
            {
                UpdateMessage,
                PromptUpdateMessage,
                AfterUpdateMessage,
            };

            // Define the conversation flow using a waterfall model.
            AddDialog(new WaterfallDialog(Actions.Delete, deleteEmail));
            AddDialog(new WaterfallDialog(Actions.Show, showEmail));
            AddDialog(new WaterfallDialog(Actions.UpdateSelectMessage, updateSelectMessage));
            InitialDialogId = Actions.Delete;
        }
示例#4
0
        public AddToDoItemDialog(
            ISkillConfiguration services,
            IStatePropertyAccessor <ToDoSkillState> accessor,
            ITaskService serviceManager)
            : base(nameof(AddToDoItemDialog), services, accessor, serviceManager)
        {
            var addToDoTask = new WaterfallStep[]
            {
                GetAuthToken,
                AfterGetAuthToken,
                ClearContext,
                CollectToDoTaskContent,
                AddToDoTask,
            };

            var collectToDoTaskContent = new WaterfallStep[]
            {
                AskToDoTaskContent,
                AfterAskToDoTaskContent,
            };

            // Define the conversation flow using a waterfall model.
            AddDialog(new WaterfallDialog(Action.AddToDoTask, addToDoTask));
            AddDialog(new WaterfallDialog(Action.CollectToDoTaskContent, collectToDoTaskContent));

            // Set starting dialog for component
            InitialDialogId = Action.AddToDoTask;
        }
示例#5
0
        public DeleteEventDialog(
            ISkillConfiguration services,
            IStatePropertyAccessor <CalendarSkillState> accessor,
            IServiceManager serviceManager)
            : base(nameof(DeleteEventDialog), services, accessor, serviceManager)
        {
            var deleteEvent = new WaterfallStep[]
            {
                GetAuthToken,
                AfterGetAuthToken,
                FromTokenToStartTime,
                ConfirmBeforeDelete,
                DeleteEventByStartTime,
            };

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

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

            // Set starting dialog for component
            InitialDialogId = Actions.DeleteEvent;
        }
示例#6
0
        public NextMeetingDialog(
            ISkillConfiguration services,
            IStatePropertyAccessor <CalendarSkillState> accessor,
            IServiceManager serviceManager,
            IBotTelemetryClient telemetryClient)
            : base(nameof(NextMeetingDialog), services, accessor, serviceManager, telemetryClient)
        {
            TelemetryClient = telemetryClient;

            var nextMeeting = new WaterfallStep[]
            {
                GetAuthToken,
                AfterGetAuthToken,
                ShowNextEvent,
            };

            // Define the conversation flow using a waterfall model.
            AddDialog(new WaterfallDialog(Actions.ShowEventsSummary, nextMeeting)
            {
                TelemetryClient = telemetryClient
            });

            // Set starting dialog for component
            InitialDialogId = Actions.ShowEventsSummary;
        }
示例#7
0
        public DeleteEmailDialog(
            ISkillConfiguration services,
            IStatePropertyAccessor <EmailSkillState> emailStateAccessor,
            IStatePropertyAccessor <DialogState> dialogStateAccessor,
            IMailSkillServiceManager serviceManager)
            : base(nameof(DeleteEmailDialog), services, emailStateAccessor, dialogStateAccessor, serviceManager)
        {
            var deleteEmail = new WaterfallStep[]
            {
                GetAuthToken,
                AfterGetAuthToken,
                PromptToDelete,
                DeleteEmail,
            };

            var showEmail = new WaterfallStep[]
            {
                PromptCollectMessage,
                ShowEmails,
            };

            // Define the conversation flow using a waterfall model.
            AddDialog(new WaterfallDialog(Actions.Delete, deleteEmail));
            AddDialog(new WaterfallDialog(Actions.Show, showEmail));
            InitialDialogId = Actions.Delete;
        }
示例#8
0
        public ConfirmRecipientDialog(
            ISkillConfiguration services,
            IStatePropertyAccessor <EmailSkillState> emailStateAccessor,
            IStatePropertyAccessor <DialogState> dialogStateAccessor,
            IServiceManager serviceManager,
            IBotTelemetryClient telemetryClient)
            : base(nameof(ConfirmRecipientDialog), services, emailStateAccessor, dialogStateAccessor, serviceManager, telemetryClient)
        {
            TelemetryClient = telemetryClient;

            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)
            {
                TelemetryClient = telemetryClient
            });
            AddDialog(new WaterfallDialog(Actions.UpdateRecipientName, updateRecipientName)
            {
                TelemetryClient = telemetryClient
            });
            InitialDialogId = Actions.ConfirmRecipient;
        }
示例#9
0
        public SummaryDialog(
            ISkillConfiguration services,
            IStatePropertyAccessor <CalendarSkillState> accessor,
            IServiceManager serviceManager)
            : base(nameof(SummaryDialog), services, accessor, serviceManager)
        {
            var showSummary = new WaterfallStep[]
            {
                IfClearContextStep,
                GetAuthToken,
                AfterGetAuthToken,
                ShowEventsSummary,
                PromptToRead,
                CallReadEventDialog,
            };

            var readEvent = new WaterfallStep[]
            {
                ReadEvent,
                AfterReadOutEvent,
            };

            // Define the conversation flow using a waterfall model.
            AddDialog(new WaterfallDialog(Actions.ShowEventsSummary, showSummary));
            AddDialog(new WaterfallDialog(Actions.Read, readEvent));

            // Set starting dialog for component
            InitialDialogId = Actions.ShowEventsSummary;
        }
示例#10
0
        public ShowEmailDialog(
            ISkillConfiguration services,
            IStatePropertyAccessor <EmailSkillState> emailStateAccessor,
            IStatePropertyAccessor <DialogState> dialogStateAccessor,
            IServiceManager serviceManager)
            : base(nameof(ShowEmailDialog), services, emailStateAccessor, dialogStateAccessor, serviceManager)
        {
            var showEmail = new WaterfallStep[]
            {
                IfClearContextStep,
                GetAuthToken,
                AfterGetAuthToken,
                ShowEmailsWithoutEnd,
                PromptToRead,
                CallReadOrDeleteDialog,
            };

            var readEmail = new WaterfallStep[]
            {
                ReadEmail,
                AfterReadOutEmail,
            };

            // Define the conversation flow using a waterfall model.
            AddDialog(new WaterfallDialog(Actions.Show, showEmail));
            AddDialog(new WaterfallDialog(Actions.Read, readEmail));
            AddDialog(new DeleteEmailDialog(services, emailStateAccessor, dialogStateAccessor, serviceManager));
            InitialDialogId = Actions.Show;
        }
示例#11
0
        // Fields, seems that new version dose not have those protected claims
        //  protected ISkillConfiguration _services;
        //  protected IStatePropertyAccessor<weatherskillState> _accessor;
        //  protected IServiceManager _serviceManager;

        public weatherskillDialog(
            string dialogId,
            ISkillConfiguration services,
            IStatePropertyAccessor <weatherskillState> accessor,
            IStatePropertyAccessor <DialogState> dialogStateAccessor,
            IServiceManager serviceManager,
            IBotTelemetryClient telemetryClient)
            : base(dialogId)
        {
            Services = services;
            Accessor = accessor;
            WeatherServiceManager = serviceManager;
            DialogStateAccessor   = dialogStateAccessor;
            TelemetryClient       = telemetryClient;

            ///     var oauthSettings = new OAuthPromptSettings()
            //    {
            //         ConnectionName = _services.AuthConnectionName ?? throw new Exception("The authentication connection has not been initialized."),
            //         Text = $"Authentication",
            //        Title = "Signin",
            //         Timeout = 300000, // User has 5 minutes to login
            //    };

            AddDialog(new EventPrompt(SkillModeAuth, "tokens/response", TokenResponseValidator));
            //      AddDialog(new OAuthPrompt(LocalModeAuth, oauthSettings, AuthPromptValidator));
        }
示例#12
0
        public SendEmailDialog(
            ISkillConfiguration services,
            IStatePropertyAccessor <EmailSkillState> emailStateAccessor,
            IStatePropertyAccessor <DialogState> dialogStateAccessor,
            IServiceManager serviceManager)
            : base(nameof(SendEmailDialog), services, emailStateAccessor, dialogStateAccessor, serviceManager)
        {
            var sendEmail = new WaterfallStep[]
            {
                IfClearContextStep,
                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;
        }
示例#13
0
        public EmailSkillDialog(
            string dialogId,
            ISkillConfiguration services,
            IStatePropertyAccessor <EmailSkillState> emailStateAccessor,
            IStatePropertyAccessor <DialogState> dialogStateAccessor,
            IMailSkillServiceManager serviceManager)
            : base(dialogId)
        {
            _services            = services;
            _emailStateAccessor  = emailStateAccessor;
            _dialogStateAccessor = dialogStateAccessor;
            _serviceManager      = serviceManager;

            var oauthSettings = new OAuthPromptSettings()
            {
                ConnectionName = _services.AuthConnectionName ?? throw new Exception("The authentication connection has not been initialized."),
                                       Text    = $"Authentication",
                                       Title   = "Signin",
                                       Timeout = 300000, // User has 5 minutes to login
            };

            AddDialog(new EventPrompt(SkillModeAuth, "tokens/response", TokenResponseValidator));
            AddDialog(new OAuthPrompt(LocalModeAuth, oauthSettings, AuthPromptValidator));
            AddDialog(new TextPrompt(Action.Prompt));
            AddDialog(new ConfirmPrompt(Action.TakeFurtherAction, null, Culture.English)
            {
                Style = ListStyle.SuggestedAction
            });
            AddDialog(new ChoicePrompt(Action.Choice, ChoiceValidator, Culture.English)
            {
                Style = ListStyle.None
            });
        }
示例#14
0
        public EmailSkillDialog(
            string dialogId,
            ISkillConfiguration services,
            IStatePropertyAccessor <EmailSkillState> emailStateAccessor,
            IStatePropertyAccessor <DialogState> dialogStateAccessor,
            IMailSkillServiceManager serviceManager)
            : base(dialogId)
        {
            Services            = services;
            EmailStateAccessor  = emailStateAccessor;
            DialogStateAccessor = dialogStateAccessor;
            ServiceManager      = serviceManager;

            if (!Services.AuthenticationConnections.Any())
            {
                throw new Exception("You must configure an authentication connection in your bot file before using this component.");
            }

            AddDialog(new EventPrompt(SkillModeAuth, "tokens/response", TokenResponseValidator));
            AddDialog(new MultiProviderAuthDialog(services));
            AddDialog(new TextPrompt(Actions.Prompt));
            AddDialog(new ConfirmPrompt(Actions.TakeFurtherAction, null, Culture.English)
            {
                Style = ListStyle.SuggestedAction
            });
            AddDialog(new ChoicePrompt(Actions.Choice, ChoiceValidator, Culture.English)
            {
                Style = ListStyle.None
            });
        }
示例#15
0
        public ShowEmailDialog(
            ISkillConfiguration services,
            IStatePropertyAccessor <EmailSkillState> emailStateAccessor,
            IStatePropertyAccessor <DialogState> dialogStateAccessor,
            IServiceManager serviceManager)
            : base(nameof(ShowEmailDialog), services, emailStateAccessor, dialogStateAccessor, serviceManager)
        {
            var showEmail = new WaterfallStep[]
            {
                IfClearContextStep,
                GetAuthToken,
                AfterGetAuthToken,
                ShowEmailsWithoutEnd,
                PromptToHandle,
                CallHandleEmailDialog,
            };

            var readEmail = new WaterfallStep[]
            {
                ReadEmail,
                HandleMore,
            };

            var deleteEmail = new WaterfallStep[]
            {
                DeleteEmail,
                PromptToReshow
            };

            var forwardEmail = new WaterfallStep[]
            {
                ForwardEmail,
                PromptToReshow
            };

            var replyEmail = new WaterfallStep[]
            {
                ReplyEmail,
                PromptToReshow
            };

            var reshowEmail = new WaterfallStep[]
            {
                ShowEmailsWithoutEnd,
                PromptToHandleMore,
                HandleMore,
            };

            // Define the conversation flow using a waterfall model.
            AddDialog(new WaterfallDialog(Actions.Show, showEmail));
            AddDialog(new WaterfallDialog(Actions.Read, readEmail));
            AddDialog(new WaterfallDialog(Actions.Delete, deleteEmail));
            AddDialog(new WaterfallDialog(Actions.Forward, forwardEmail));
            AddDialog(new WaterfallDialog(Actions.Reply, replyEmail));
            AddDialog(new WaterfallDialog(Actions.Reshow, reshowEmail));
            AddDialog(new DeleteEmailDialog(services, emailStateAccessor, dialogStateAccessor, serviceManager));
            AddDialog(new ReplyEmailDialog(services, emailStateAccessor, dialogStateAccessor, serviceManager));
            AddDialog(new ForwardEmailDialog(services, emailStateAccessor, dialogStateAccessor, serviceManager));
            InitialDialogId = Actions.Show;
        }
示例#16
0
        public TimeRemainingDialog(
            ISkillConfiguration services,
            IStatePropertyAccessor <CalendarSkillState> accessor,
            IServiceManager serviceManager,
            IBotTelemetryClient telemetryClient)
            : base(nameof(TimeRemainingDialog), services, accessor, serviceManager, telemetryClient)
        {
            TelemetryClient = telemetryClient;

            var timeRemain = new WaterfallStep[]
            {
                GetAuthToken,
                AfterGetAuthToken,
                CheckTimeRemain,
            };

            // Define the conversation flow using a waterfall model.
            AddDialog(new WaterfallDialog(Actions.ShowTimeRemaining, timeRemain)
            {
                TelemetryClient = telemetryClient
            });

            // Set starting dialog for component
            InitialDialogId = Actions.ShowTimeRemaining;
        }
示例#17
0
        public ToDoSkillDialog(
            string dialogId,
            ISkillConfiguration services,
            IStatePropertyAccessor <ToDoSkillState> toDoStateAccessor,
            IStatePropertyAccessor <ToDoSkillUserState> userStateAccessor,
            ITaskService serviceManager,
            IMailService mailService,
            IBotTelemetryClient telemetryClient)
            : base(dialogId)
        {
            Services          = services;
            ToDoStateAccessor = toDoStateAccessor;
            UserStateAccessor = userStateAccessor;
            ServiceManager    = serviceManager;
            MailService       = mailService;
            TelemetryClient   = telemetryClient;

            if (!Services.AuthenticationConnections.Any())
            {
                throw new Exception("You must configure an authentication connection in your bot file before using this component.");
            }

            AddDialog(new EventPrompt(SkillModeAuth, "tokens/response", TokenResponseValidator));
            AddDialog(new MultiProviderAuthDialog(services));
            AddDialog(new TextPrompt(Action.Prompt));
        }
示例#18
0
        public VehicleSettingsDialog(
            ISkillConfiguration services,
            IStatePropertyAccessor <AutomotiveSkillState> accessor,
            IServiceManager serviceManager,
            IBotTelemetryClient telemetryClient,
            IHttpContextAccessor httpContext)
            : base(nameof(VehicleSettingsDialog), services, accessor, serviceManager, telemetryClient)
        {
            TelemetryClient = telemetryClient;

            // Initialise supporting LUIS models for followup questions
            vehicleSettingNameSelectionLuisRecognizer  = services.LocaleConfigurations["en"].LuisServices["settings_name"];
            vehicleSettingValueSelectionLuisRecognizer = services.LocaleConfigurations["en"].LuisServices["settings_value"];

            // JSON resource files provided metatadata as to the available car settings, names and the values that can be set
            var resDir = Path.Combine(
                Path.GetDirectoryName(typeof(VehicleSettingsDialog).Assembly.Location),
                "Dialogs\\VehicleSettings\\Resources\\");

            settingList   = new SettingList(resDir + "available_settings.json", resDir + "setting_alternative_names.json");
            settingFilter = new SettingFilter(settingList);

            // Setting Change waterfall
            var processVehicleSettingChangeWaterfall = new WaterfallStep[]
            {
                ProcessSetting,
                ProcessVehicleSettingsChange,
                ProcessChange,
                SendChange
            };

            AddDialog(new WaterfallDialog(Actions.ProcessVehicleSettingChange, processVehicleSettingChangeWaterfall)
            {
                TelemetryClient = telemetryClient
            });

            // Prompts
            AddDialog(new ChoicePrompt(Actions.SettingNameSelectionPrompt, SettingNameSelectionValidator, Culture.English)
            {
                Style = ListStyle.Inline, ChoiceOptions = new ChoiceFactoryOptions {
                    InlineSeparator = string.Empty, InlineOr = string.Empty, InlineOrMore = string.Empty, IncludeNumbers = true
                }
            });
            AddDialog(new ChoicePrompt(Actions.SettingValueSelectionPrompt, SettingValueSelectionValidator, Culture.English)
            {
                Style = ListStyle.Inline, ChoiceOptions = new ChoiceFactoryOptions {
                    InlineSeparator = string.Empty, InlineOr = string.Empty, InlineOrMore = string.Empty, IncludeNumbers = true
                }
            });

            AddDialog(new ConfirmPrompt(Actions.SettingConfirmationPrompt));

            // Set starting dialog for component
            InitialDialogId = Actions.ProcessVehicleSettingChange;

            // Used to resolve image paths (local or hosted)
            _httpContext = httpContext;
        }
示例#19
0
        public SummaryDialog(
            ISkillConfiguration services,
            IStatePropertyAccessor <CalendarSkillState> accessor,
            IServiceManager serviceManager,
            IBotTelemetryClient telemetryClient)
            : base(nameof(SummaryDialog), services, accessor, serviceManager, telemetryClient)
        {
            TelemetryClient = telemetryClient;

            var initStep = new WaterfallStep[]
            {
                GetAuthToken,
                AfterGetAuthToken,
                Init,
            };

            var showNext = new WaterfallStep[]
            {
                ShowNextEvent,
            };

            var showSummary = new WaterfallStep[]
            {
                IfClearContextStep,
                ShowEventsSummary,
                PromptToRead,
                CallReadEventDialog,
            };

            var readEvent = new WaterfallStep[]
            {
                ReadEvent,
                AfterReadOutEvent,
            };

            // Define the conversation flow using a waterfall model.
            AddDialog(new WaterfallDialog(Actions.GetEventsInit, initStep)
            {
                TelemetryClient = telemetryClient
            });
            AddDialog(new WaterfallDialog(Actions.ShowNextEvent, showNext)
            {
                TelemetryClient = telemetryClient
            });
            AddDialog(new WaterfallDialog(Actions.ShowEventsSummary, showSummary)
            {
                TelemetryClient = telemetryClient
            });
            AddDialog(new WaterfallDialog(Actions.Read, readEvent)
            {
                TelemetryClient = telemetryClient
            });
            AddDialog(new UpdateEventDialog(services, accessor, serviceManager, telemetryClient));
            AddDialog(new DeleteEventDialog(services, accessor, serviceManager, telemetryClient));

            // Set starting dialog for component
            InitialDialogId = Actions.GetEventsInit;
        }
示例#20
0
 public NewsDialog(
     string dialogId,
     ISkillConfiguration services,
     IStatePropertyAccessor <NewsSkillState> accessor,
     IBotTelemetryClient telemetryClient)
     : base(dialogId)
 {
     Services        = services;
     Accessor        = accessor;
     TelemetryClient = telemetryClient;
 }
示例#21
0
        public NewsSkill(ISkillConfiguration services, ConversationState conversationState, UserState userState, IBotTelemetryClient telemetryClient, bool skillMode = false)
        {
            _skillMode         = skillMode;
            _services          = services;
            _conversationState = conversationState;
            _userState         = userState;
            _telemetryClient   = telemetryClient ?? throw new ArgumentNullException(nameof(telemetryClient));

            _dialogs = new DialogSet(_conversationState.CreateProperty <DialogState>(nameof(DialogState)));
            _dialogs.Add(new MainDialog(_services, _conversationState, _userState, _telemetryClient, _skillMode));
        }
示例#22
0
        public CalendarSkill(ISkillConfiguration services, ConversationState conversationState, UserState userState, IServiceManager serviceManager = null, bool skillMode = false)
        {
            _skillMode         = skillMode;
            _services          = services ?? throw new ArgumentNullException(nameof(services));
            _userState         = userState ?? throw new ArgumentNullException(nameof(userState));
            _conversationState = conversationState ?? throw new ArgumentNullException(nameof(conversationState));
            _serviceManager    = serviceManager ?? new ServiceManager(_services);

            _dialogs = new DialogSet(_conversationState.CreateProperty <DialogState>(nameof(DialogState)));
            _dialogs.Add(new MainDialog(_services, _conversationState, _userState, _serviceManager, _skillMode));
        }
示例#23
0
 public RestaurantBookingDialog(
     string dialogId,
     ISkillConfiguration services,
     IStatePropertyAccessor <RestaurantBookingState> accessor,
     IServiceManager serviceManager,
     IBotTelemetryClient telemetryClient)
     : base(nameof(RestaurantBookingDialog))
 {
     Services        = services;
     Accessor        = accessor;
     ServiceManager  = serviceManager;
     TelemetryClient = telemetryClient;
 }
示例#24
0
 public AutomotiveSkillDialog(
     string dialogId,
     ISkillConfiguration services,
     IStatePropertyAccessor <AutomotiveSkillState> accessor,
     IServiceManager serviceManager,
     IBotTelemetryClient telemetryClient)
     : base(dialogId)
 {
     Services        = services;
     Accessor        = accessor;
     ServiceManager  = serviceManager;
     TelemetryClient = telemetryClient;
 }
示例#25
0
        public AutomotiveSkill(ISkillConfiguration services, ConversationState conversationState, UserState userState, IBotTelemetryClient telemetryClient, ServiceManager serviceManager = null, IHttpContextAccessor httpContext = null, bool skillMode = false)
        {
            _skillMode         = skillMode;
            _services          = services ?? throw new ArgumentNullException(nameof(services));
            _userState         = userState ?? throw new ArgumentNullException(nameof(userState));
            _httpContext       = httpContext ?? throw new ArgumentNullException(nameof(httpContext));
            _conversationState = conversationState ?? throw new ArgumentNullException(nameof(conversationState));
            _serviceManager    = serviceManager ?? new ServiceManager();
            _telemetryClient   = telemetryClient ?? throw new ArgumentNullException(nameof(telemetryClient));

            _dialogs = new DialogSet(_conversationState.CreateProperty <DialogState>(nameof(DialogState)));
            _dialogs.Add(new MainDialog(_services, _conversationState, _userState, _serviceManager, _httpContext, _telemetryClient, _skillMode));
        }
示例#26
0
        public ShowToDoItemDialog(
            ISkillConfiguration services,
            IStatePropertyAccessor <ToDoSkillState> toDoStateAccessor,
            IStatePropertyAccessor <ToDoSkillUserState> userStateAccessor,
            ITaskService serviceManager,
            IMailService mailService,
            IBotTelemetryClient telemetryClient)
            : base(nameof(ShowToDoItemDialog), services, toDoStateAccessor, userStateAccessor, serviceManager, mailService, telemetryClient)
        {
            TelemetryClient = telemetryClient;

            var showToDoTasks = new WaterfallStep[]
            {
                GetAuthToken,
                AfterGetAuthToken,
                ClearContext,
                ShowToDoTasks,
                AddFirstTask,
            };

            var addFirstTask = new WaterfallStep[]
            {
                AskAddFirstTaskConfirmation,
                AfterAskAddFirstTaskConfirmation,
                CollectToDoTaskContent,
                AddToDoTask,
            };

            var collectToDoTaskContent = new WaterfallStep[]
            {
                AskToDoTaskContent,
                AfterAskToDoTaskContent,
            };

            // Define the conversation flow using a waterfall model.
            AddDialog(new WaterfallDialog(Action.ShowToDoTasks, showToDoTasks)
            {
                TelemetryClient = telemetryClient
            });
            AddDialog(new WaterfallDialog(Action.AddFirstTask, addFirstTask)
            {
                TelemetryClient = telemetryClient
            });
            AddDialog(new WaterfallDialog(Action.CollectToDoTaskContent, collectToDoTaskContent)
            {
                TelemetryClient = telemetryClient
            });

            // Set starting dialog for component
            InitialDialogId = Action.ShowToDoTasks;
        }
示例#27
0
        public DeleteToDoItemDialog(
            ISkillConfiguration services,
            IStatePropertyAccessor <ToDoSkillState> toDoStateAccessor,
            IStatePropertyAccessor <ToDoSkillUserState> userStateAccessor,
            ITaskService serviceManager,
            IMailService mailService,
            IBotTelemetryClient telemetryClient)
            : base(nameof(DeleteToDoItemDialog), services, toDoStateAccessor, userStateAccessor, serviceManager, mailService, telemetryClient)
        {
            TelemetryClient = telemetryClient;

            var deleteToDoTask = new WaterfallStep[]
            {
                GetAuthToken,
                AfterGetAuthToken,
                ClearContext,
                InitAllTasks,
                CollectToDoTaskIndex,
                CollectAskDeletionConfirmation,
                DeleteToDoTask,
            };

            var collectToDoTaskIndex = new WaterfallStep[]
            {
                AskToDoTaskIndex,
                AfterAskToDoTaskIndex,
            };

            var collectDeleteTaskConfirmation = new WaterfallStep[]
            {
                AskDeletionConfirmation,
                AfterAskDeletionConfirmation,
            };

            // Define the conversation flow using a waterfall model.
            AddDialog(new WaterfallDialog(Action.DeleteToDoTask, deleteToDoTask)
            {
                TelemetryClient = telemetryClient
            });
            AddDialog(new WaterfallDialog(Action.CollectToDoTaskIndex, collectToDoTaskIndex)
            {
                TelemetryClient = telemetryClient
            });
            AddDialog(new WaterfallDialog(Action.CollectDeleteTaskConfirmation, collectDeleteTaskConfirmation)
            {
                TelemetryClient = telemetryClient
            });

            // Set starting dialog for component
            InitialDialogId = Action.DeleteToDoTask;
        }
示例#28
0
        public ReplyEmailDialog(
            ISkillConfiguration services,
            IStatePropertyAccessor <EmailSkillState> emailStateAccessor,
            IStatePropertyAccessor <DialogState> dialogStateAccessor,
            IServiceManager serviceManager,
            IBotTelemetryClient telemetryClient)
            : base(nameof(ReplyEmailDialog), services, emailStateAccessor, dialogStateAccessor, serviceManager, telemetryClient)
        {
            TelemetryClient = telemetryClient;

            var replyEmail = new WaterfallStep[]
            {
                IfClearContextStep,
                GetAuthToken,
                AfterGetAuthToken,
                CollectSelectedEmail,
                AfterCollectSelectedEmail,
                CollectAdditionalText,
                ConfirmBeforeSending,
                ReplyEmail,
            };

            var showEmail = new WaterfallStep[]
            {
                PagingStep,
                ShowEmails,
            };

            var updateSelectMessage = new WaterfallStep[]
            {
                UpdateMessage,
                PromptUpdateMessage,
                AfterUpdateMessage,
            };

            AddDialog(new WaterfallDialog(Actions.Reply, replyEmail));

            // Define the conversation flow using a waterfall model.
            AddDialog(new WaterfallDialog(Actions.Show, showEmail)
            {
                TelemetryClient = telemetryClient
            });
            AddDialog(new WaterfallDialog(Actions.UpdateSelectMessage, updateSelectMessage)
            {
                TelemetryClient = telemetryClient
            });

            InitialDialogId = Actions.Reply;
        }
示例#29
0
        public MainDialog(SkillConfiguration services, ConversationState conversationState, UserState userState, IBotTelemetryClient telemetryClient, IServiceManager serviceManager, bool skillMode)
            : base(nameof(MainDialog), telemetryClient)
        {
            _skillMode         = skillMode;
            _services          = services;
            _conversationState = conversationState;
            _userState         = userState;
            _serviceManager    = serviceManager;

            // Initialize state accessor
            _stateAccessor       = _conversationState.CreateProperty <weatherskillState>(nameof(weatherskillState));
            _dialogStateAccessor = _conversationState.CreateProperty <DialogState>(nameof(DialogState));

            RegisterDialogs();
        }
示例#30
0
        public MainDialog(ISkillConfiguration services, ConversationState conversationState, UserState userState, IMailSkillServiceManager serviceManager, bool skillMode)
            : base(nameof(MainDialog))
        {
            _skillMode         = skillMode;
            _services          = services;
            _conversationState = conversationState;
            _userState         = userState;
            _serviceManager    = serviceManager;

            // Initialize state accessor
            _stateAccessor       = _conversationState.CreateProperty <EmailSkillState>(nameof(EmailSkillState));
            _dialogStateAccessor = _conversationState.CreateProperty <DialogState>(nameof(DialogState));

            RegisterDialogs();
        }