public VisualHgService() { worker = new IdleWorker(); worker.DoWork += (s, e) => Update(); repository = new VisualHgRepository(); repository.StatusChanged += OnRepositoryStatusChanged; repository.SolutionFiles.Changed += (s, e) => UpdatePendingChangesToolWindow(); var solution = Package.GetGlobalService(typeof(SVsSolution)) as IVsSolution; solution.AdviseSolutionEvents(this, out vsSolutionEventsCookie); Debug.Assert(vsSolutionEventsCookie != VSConstants.VSCOOKIE_NIL); var trackProjectDocuments = Package.GetGlobalService(typeof(SVsTrackProjectDocuments)) as IVsTrackProjectDocuments2; trackProjectDocuments.AdviseTrackProjectDocumentsEvents(this, out trackProjectDocumentsEventsCookie); Debug.Assert(trackProjectDocumentsEventsCookie != VSConstants.VSCOOKIE_NIL); var buildManager = Package.GetGlobalService(typeof(SVsSolutionBuildManager)) as IVsSolutionBuildManager; buildManager.AdviseUpdateSolutionEvents(this, out buildManagerCookie); Debug.Assert(buildManagerCookie != VSConstants.VSCOOKIE_NIL); }