コード例 #1
0
        public VisualStudioTodoCommentsService(
            VisualStudioWorkspaceImpl workspace,
            IGlobalOptionService globalOptions,
            IThreadingContext threadingContext,
            IAsynchronousOperationListenerProvider asynchronousOperationListenerProvider,
            [ImportMany] IEnumerable <Lazy <IEventListener, EventListenerMetadata> > eventListeners)
            : base(threadingContext)
        {
            _workspace            = workspace;
            _eventListenerTracker = new EventListenerTracker <ITodoListProvider>(eventListeners, WellKnownEventListeners.TodoListProvider);

            _listener = new TodoCommentsListener(
                globalOptions,
                workspace.Services,
                asynchronousOperationListenerProvider,
                onTodoCommentsUpdated: (documentId, oldComments, newComments) =>
            {
                if (TodoListUpdated != null && !oldComments.SequenceEqual(newComments))
                {
                    TodoListUpdated?.Invoke(
                        this, new TodoItemsUpdatedArgs(
                            documentId, _workspace, _workspace.CurrentSolution,
                            documentId.ProjectId, documentId, newComments));
                }
            },
                threadingContext.DisposalToken);
        }
コード例 #2
0
 private void OnTodoListChanged(TodoListAction action, TodoItem item)
 => TodoListUpdated?.Invoke(this, new TodoListEventArgs(action, item));