public static VsSolutionTestCoverage CreateInstanceIfDoesNotExist(Workspace myWorkspace,
            ISolutionCoverageEngine solutionCoverageEngine,
            ICoverageStore coverageStore)
        {
            if (_vsSolutionTestCoverage == null)
            {
                lock (SyncObject)
                {
                    if (_vsSolutionTestCoverage == null)
                    {
                        _vsSolutionTestCoverage = new VsSolutionTestCoverage(myWorkspace, solutionCoverageEngine, coverageStore);
                        _vsSolutionTestCoverage.Reinit();
                        _vsSolutionTestCoverage.LoadCurrentCoverage();
                    }
                }
            }

            return _vsSolutionTestCoverage;
        }
        public TestDotsCoverageVsPlugin(VsSolutionTestCoverage vsSolutionTestCoverage,
            ITaskCoverageManager taskCoverageManager,
            IWpfTextView textView,
            IVsStatusbar statusBar,
            Solution solution)
        {
            _vsSolutionTestCoverage = vsSolutionTestCoverage;
            _taskCoverageManager = taskCoverageManager;

            _canvas = new Canvas();
            _textView = textView;
            _statusBar = statusBar;
            _solution = solution;

            _textView.ViewportHeightChanged += (s, e) => Redraw();
            _textView.LayoutChanged += LayoutChanged;
            this.Width = 20;
            this.ClipToBounds = true;
            this.Background = new SolidColorBrush(Colors.White);
            Children.Add(_canvas);
            textView.TextBuffer.Changed += TextBuffer_Changed;

            _taskCoverageManager.CoverageTaskEvent += TaskCoverageManagerCoverageTaskEvent;
        }
 public void Dispose()
 {
     _vsSolutionTestCoverage = null;
 }
        private void InitSolutionCoverageEngine()
        {
            InitMyWorkspace(_serviceProvider);
            string solutionPath = _dte.Solution.FullName;

            if (_vsSolutionTestCoverage != null && _vsSolutionTestCoverage.MyWorkspace == _myWorkspace)
                return;

            Config.SetSolution(solutionPath);

            var sqlCompactCoverageStore = new SqlCompactCoverageStore();
            var rewrittenDocumentsStorage = new RewrittenDocumentsStorage();

            _vsSolutionTestCoverage = VsSolutionTestCoverage.CreateInstanceIfDoesNotExist(_myWorkspace,
                new SolutionCoverageEngine(),
                sqlCompactCoverageStore);

            _taskCoverageManager = new TaskCoverageManager(new VsDispatchTimer(), new RoslynDocumentProvider(), _vsSolutionTestCoverage);
            _roslynSolutionWatcher = new RoslynSolutionWatcher(_dte, _myWorkspace,
                sqlCompactCoverageStore, rewrittenDocumentsStorage, _taskCoverageManager);
            _roslynSolutionWatcher.DocumentRemoved += _roslynSolutionWatcher_DocumentRemoved;
            _roslynSolutionWatcher.Start();
        }
 private void SolutionEvents_AfterClosing()
 {
     _vsSolutionTestCoverage.Dispose();
     _vsSolutionTestCoverage = null;
 }