public void Dispose() { // Unregister from receiving solution events if (VSConstants.VSCOOKIE_NIL != _vsSolutionEventsCookie) { IVsSolution sol = (IVsSolution)_sccProvider.GetService(typeof(SVsSolution)); sol.UnadviseSolutionEvents(_vsSolutionEventsCookie); _vsSolutionEventsCookie = VSConstants.VSCOOKIE_NIL; } // Unregister from receiving project documents if (VSConstants.VSCOOKIE_NIL != _tpdTrackProjectDocumentsCookie) { IVsTrackProjectDocuments2 tpdService = (IVsTrackProjectDocuments2)_sccProvider.GetService(typeof(SVsTrackProjectDocuments)); tpdService.UnadviseTrackProjectDocumentsEvents(_tpdTrackProjectDocumentsCookie); _tpdTrackProjectDocumentsCookie = VSConstants.VSCOOKIE_NIL; } // Unregister from storrage events _sccStatusTracker.HGStatusChanged -= new HGLib.HGStatusChangedEvent(SetNodesGlyphsDirty); IVsSolutionBuildManager buildManagerService = _sccProvider.GetService(typeof(SVsSolutionBuildManager)) as IVsSolutionBuildManager; buildManagerService.UnadviseUpdateSolutionEvents(_dwBuildManagerCooky); }
///////////////////////////////////////////////////////////////////////////// // SccProvider Package Implementation #region Package Members public static Object GetServiceEx(Type serviceType) { if (_SccProvider != null) { return(_SccProvider.GetService(serviceType)); } return(null); }
// remember the latest OnQueryRemoveDirectories remove list //string[] _RemoveDirectoriesQueue = null; #region SccProvider Service initialization/unitialization public SccProviderService(SccProvider sccProvider) { Debug.Assert(null != sccProvider); _sccProvider = sccProvider; // Subscribe to solution events IVsSolution sol = (IVsSolution)_sccProvider.GetService(typeof(SVsSolution)); sol.AdviseSolutionEvents(this, out _vsSolutionEventsCookie); Debug.Assert(VSConstants.VSCOOKIE_NIL != _vsSolutionEventsCookie); // Subscribe to project documents IVsTrackProjectDocuments2 tpdService = (IVsTrackProjectDocuments2)_sccProvider.GetService(typeof(SVsTrackProjectDocuments)); tpdService.AdviseTrackProjectDocumentsEvents(this, out _tpdTrackProjectDocumentsCookie); Debug.Assert(VSConstants.VSCOOKIE_NIL != _tpdTrackProjectDocumentsCookie); // Subscribe to status events _sccStatusTracker.HGStatusChanged += new HGLib.HGStatusChangedEvent(SetNodesGlyphsDirty); IVsSolutionBuildManager buildManagerService = _sccProvider.GetService(typeof(SVsSolutionBuildManager)) as IVsSolutionBuildManager; buildManagerService.AdviseUpdateSolutionEvents(this, out _dwBuildManagerCooky); }