public ErrorHighlighter(IWpfTextView view, ITextDocument document, IVsTaskList tasks, DTE2 dte, SVsServiceProvider serviceProvider)
        {
            _view            = view;
            _document        = document;
            _text            = new Adornment();
            _tasks           = tasks;
            _serviceProvider = serviceProvider;
            _dispatcher      = Dispatcher.CurrentDispatcher;

            _adornmentLayer = view.GetAdornmentLayer(ErrorHighlighterFactory.LayerName);

            _view.ViewportHeightChanged += SetAdornmentLocation;
            _view.ViewportWidthChanged  += SetAdornmentLocation;

            _text.MouseUp += (s, e) => { dte.ExecuteCommand("View.ErrorList"); };

            _timer          = new Timer(750);
            _timer.Elapsed += (s, e) =>
            {
                _timer.Stop();
                System.Threading.Tasks.Task.Run(() =>
                {
                    _dispatcher.Invoke(new Action(() =>
                    {
                        Update(false);
                    }), DispatcherPriority.ApplicationIdle, null);
                });
            };
            _timer.Start();
        }
Ejemplo n.º 2
0
        public ErrorHighlighter(IWpfTextView view, ITextDocument document, IVsTaskList tasks, DTE2 dte)
        {
            _view = view;
            _document = document;
            _text = new Adornment();
            _tasks = tasks;
            _dispatcher = Dispatcher.CurrentDispatcher;

            _adornmentLayer = view.GetAdornmentLayer(ErrorHighlighterFactory.LayerName);

            _view.ViewportHeightChanged += SetAdornmentLocation;
            _view.ViewportWidthChanged += SetAdornmentLocation;

            _text.MouseUp += (s, e) => { dte.ExecuteCommand("View.ErrorList"); };

            _timer = new Timer(750);
            _timer.Elapsed += (s, e) =>
            {
                _timer.Stop();
                Task.Run(() =>
                {
                    _dispatcher.Invoke(new Action(() =>
                    {
                        Update(false);
                    }), DispatcherPriority.ApplicationIdle, null);
                });
            };
            _timer.Start();
        }