/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { base.Initialize(); var settingsStore = new Lazy <WritableSettingsStore>(() => { return(new ShellSettingsManager(this). GetWritableSettingsStore(SettingsScope.UserSettings)); }); Settings = new BuildHelperSettings(settingsStore); m_VsInstance = (DTE2)GetService(typeof(DTE)); var solutionBuildManager = (IVsSolutionBuildManager2)GetService(typeof(SVsSolutionBuildManager)); var statusBar = (IVsStatusbar)GetService(typeof(SVsStatusbar)); var logger = new ExtensionLogger(() => GetService(typeof(SVsActivityLog)) as IVsActivityLog, statusBar); //never cache the activity log reference var serviceHelper = new ServiceHelper(logger); var processHelper = new ProcessHelper(logger); m_BuildTracker = new BuildTracker( m_VsInstance, solutionBuildManager, Settings, serviceHelper, processHelper); }
public BuildTracker( DTE2 vsInstance, IVsSolutionBuildManager2 buildManager, BuildHelperSettings settings, ServiceHelper serviceHelper, ProcessHelper processHelper) { Ensure.That(() => vsInstance).IsNotNull(); Ensure.That(() => settings).IsNotNull(); Ensure.That(() => serviceHelper).IsNotNull(); Ensure.That(() => processHelper).IsNotNull(); Ensure.That(() => buildManager).IsNotNull(); m_VsInstance = vsInstance; m_Settings = settings; m_ServiceHelper = serviceHelper; m_ProcessHelper = processHelper; m_BuildManager = buildManager; m_BuildManager.AdviseUpdateSolutionEvents(this, out uint pdwCookieSolutionBM); }