Microsoft.VisualStudio.Project.UpdateSolutionEventsListener.UpdateSolutionEventsListener C# (CSharp) Method

UpdateSolutionEventsListener() protected method

Overloaded constructor.
protected UpdateSolutionEventsListener ( System.IServiceProvider serviceProvider ) : System
serviceProvider System.IServiceProvider A service provider.
return System
        protected UpdateSolutionEventsListener(IServiceProvider serviceProvider)
        {
            if(serviceProvider == null)
            {
                throw new ArgumentNullException("serviceProvider");
            }

            this.serviceProvider = serviceProvider;

            this.solutionBuildManager = this.serviceProvider.GetService(typeof(SVsSolutionBuildManager)) as IVsSolutionBuildManager2;

            if(this.solutionBuildManager == null)
            {
                throw new InvalidOperationException();
            }

            ErrorHandler.ThrowOnFailure(this.solutionBuildManager.AdviseUpdateSolutionEvents(this, out this.solutionEvents2Cookie));

            Debug.Assert(this.solutionBuildManager is IVsSolutionBuildManager3, "The solution build manager object implementing IVsSolutionBuildManager2 does not implement IVsSolutionBuildManager3");
            ErrorHandler.ThrowOnFailure(this.SolutionBuildManager3.AdviseUpdateSolutionEvents3(this, out this.solutionEvents3Cookie));
        }