Beispiel #1
0
        /// <summary>
        /// Init task service.
        /// </summary>
        /// <param name="token">Task service token.</param>
        /// <param name="listTypeIds">Task list name and id dictionary.</param>
        /// <param name="taskServiceType">The task service type.</param>
        /// <returns>Task service itself.</returns>
        public ITaskService InitTaskService(string token, Dictionary <string, string> listTypeIds, ServiceProviderTypes.ProviderTypes taskServiceType)
        {
            ITaskService taskService;

            if (taskServiceType == ServiceProviderTypes.ProviderTypes.OneNote)
            {
                var oneNoteService = new OneNoteService();
                taskService = oneNoteService.InitAsync(token, listTypeIds).Result;
            }
            else
            {
                var outlookService = new OutlookService();
                taskService = outlookService.InitAsync(token, listTypeIds).Result;
            }

            return(taskService);
        }
Beispiel #2
0
        public ToDoSkill(SkillConfiguration services, ConversationState conversationState, UserState userState, ITaskService 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));

            var isOutlookProvider = _services.Properties.ContainsKey("TaskServiceProvider") &&
                                    _services.Properties["TaskServiceProvider"].ToString().Equals(ProviderTypes.Outlook.ToString(), StringComparison.InvariantCultureIgnoreCase);
            ITaskService taskService = new OneNoteService();

            if (isOutlookProvider)
            {
                taskService = new OutlookService();
            }

            _serviceManager = serviceManager ?? taskService;

            _dialogs = new DialogSet(_conversationState.CreateProperty <DialogState>(nameof(DialogState)));
            _dialogs.Add(new MainDialog(_services, _conversationState, _userState, _serviceManager, _skillMode));
        }