Microsoft.Samples.VisualStudio.SourceControlIntegration.SccProvider.SccProvider.GetService C# (CSharp) Method

GetService() public method

public GetService ( Type serviceType ) : Object
serviceType System.Type
return Object
        public new Object GetService(Type serviceType)
        {
            return base.GetService(serviceType);
        }

Usage Example

        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);
        }