Ejemplo n.º 1
0
        private void Refresh()
        {
            IVsTaskList taskList = _serviceProvider.GetService(typeof(SVsTaskList)) as IVsTaskList;
            int         hr       = taskList.RefreshTasks(_cookie);

            Debug.Assert(hr == VSConstants.S_OK, "RefreshTasks did not return S_OK.");
        }
Ejemplo n.º 2
0
        private void Refresh_Click(object sender, RoutedEventArgs e)
        {
            if ((_service != null) && (_providerCookie != VSConstants.VSCOOKIE_NIL))
            {
                int hr = _service.RefreshTasks(_providerCookie);

                if (ErrorHandler.Succeeded(hr))
                {
                    this.Refresh.Foreground = Brushes.Green;

                    return;
                }
            }

            this.Refresh.Foreground = Brushes.Red;
        }
Ejemplo n.º 3
0
 private void TaskListRefresh()
 {
     if (taskList != null && taskListCookie != 0)
     {
         taskList.RefreshTasks(taskListCookie);
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Refresh the TaskList on the screen.
        /// </summary>
        public void Refresh()
        {
            IVsTaskList taskList = serviceProvider.GetService(typeof(SVsTaskList)) as IVsTaskList;

            if (taskList != null)
            {
                taskList.RefreshTasks(cookie);
            }
        }
Ejemplo n.º 5
0
        private async Task RefreshAsync()
        {
            var buffers           = new HashSet <ITextBuffer>();
            var bufferToErrorList = new Dictionary <ITextBuffer, List <TaskProviderItem> >();

            if (_errorProvider != null)
            {
                lock (_errorSources) {
                    foreach (var kv in _errorSources)
                    {
                        List <TaskProviderItem> items;
                        buffers.UnionWith(kv.Value);

                        lock (_itemsLock) {
                            if (!_items.TryGetValue(kv.Key, out items))
                            {
                                continue;
                            }

                            foreach (var item in items)
                            {
                                if (item.IsValid)
                                {
                                    List <TaskProviderItem> itemList;
                                    if (!bufferToErrorList.TryGetValue(item.Snapshot.TextBuffer, out itemList))
                                    {
                                        bufferToErrorList[item.Snapshot.TextBuffer] = itemList = new List <TaskProviderItem>();
                                    }

                                    itemList.Add(item);
                                }
                            }
                        }
                    }
                }
            }

            await _serviceProvider.GetUIThread().InvokeAsync(() => {
                if (_taskList != null)
                {
                    if (_cookie == 0)
                    {
                        ErrorHandler.ThrowOnFailure(_taskList.RegisterTaskProvider(this, out _cookie));
                    }
                    try {
                        _taskList.RefreshTasks(_cookie);
                    } catch (InvalidComObjectException) {
                        // DevDiv2 759317 - Watson bug, COM object can go away...
                    }
                }

                if (_errorProvider != null)
                {
                    foreach (var kv in bufferToErrorList)
                    {
                        var tagger = _errorProvider.GetErrorTagger(kv.Key);
                        if (tagger == null)
                        {
                            continue;
                        }

                        if (buffers.Remove(kv.Key))
                        {
                            tagger.RemoveTagSpans(span => span.Span.TextBuffer == kv.Key);
                        }

                        foreach (var taskProviderItem in kv.Value)
                        {
                            taskProviderItem.CreateSquiggleSpan(tagger);
                        }
                    }

                    if (buffers.Any())
                    {
                        // Clear tags for any remaining buffers.
                        foreach (var buffer in buffers)
                        {
                            var tagger = _errorProvider.GetErrorTagger(buffer);
                            tagger.RemoveTagSpans(span => span.Span.TextBuffer == buffer);
                        }
                    }
                }
            });
        }
Ejemplo n.º 6
0
        private async Task RefreshAsync()
        {
            var buffers           = new HashSet <ITextBuffer>();
            var bufferToErrorList = new Dictionary <ITextBuffer, List <TaskProviderItem> >();

            if (_errorProvider != null)
            {
                lock (_errorSources) {
                    foreach (var kv in _errorSources)
                    {
                        List <TaskProviderItem> items;
                        buffers.UnionWith(kv.Value);

                        lock (_itemsLock) {
                            if (!_items.TryGetValue(kv.Key, out items))
                            {
                                continue;
                            }

                            // Don't care if functions is empty - we need to
                            // perform the refresh to clear out old squiggles
                            foreach (var item in items)
                            {
                                if (item.IsValid)
                                {
                                    List <TaskProviderItem> itemList;
                                    if (!bufferToErrorList.TryGetValue(item.Snapshot.TextBuffer, out itemList))
                                    {
                                        bufferToErrorList[item.Snapshot.TextBuffer] = itemList = new List <TaskProviderItem>();
                                    }

                                    itemList.Add(item);
                                }
                            }
                        }
                    }
                }
            }

            await UIThread.InvokeAsync(() => {
                if (_errorList != null)
                {
                    try {
                        _errorList.RefreshTasks(_cookie);
                    } catch (InvalidComObjectException) {
                        // DevDiv2 759317 - Watson bug, COM object can go away...
                    }
                }

                if (bufferToErrorList.Any())
                {
                    foreach (var kv in bufferToErrorList)
                    {
                        var tagger = _errorProvider.GetErrorTagger(kv.Key);
                        if (tagger == null)
                        {
                            continue;
                        }

                        if (buffers.Remove(kv.Key))
                        {
                            tagger.RemoveTagSpans(span => span.Span.TextBuffer == kv.Key);
                        }

                        foreach (var taskProviderItem in kv.Value)
                        {
                            taskProviderItem.CreateSquiggleSpan(tagger);
                        }
                    }
                }

                if (_errorProvider != null && buffers.Any())
                {
                    // Clear tags for any remaining buffers.
                    foreach (var buffer in buffers)
                    {
                        var tagger = _errorProvider.GetErrorTagger(buffer);
                        tagger.RemoveTagSpans(span => span.Span.TextBuffer == buffer);
                    }
                }
            });
        }