/// <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 async System.Threading.Tasks.Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress) { // Handle commandline switch await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); var cmdLine = await GetServiceAsync(typeof(SVsAppCommandLine)) as IVsAppCommandLine; ErrorHandler.ThrowOnFailure(cmdLine.GetOption(_cliSwitch, out int isPresent, out string optionValue)); if (isPresent == 1) { System.Console.WriteLine(Vsix.Version); } _dte = await GetServiceAsync <DTE>(); _solution = await GetServiceAsync <SVsSolution>() as IVsSolution; _solutionBuildManager = await GetServiceAsync <IVsSolutionBuildManager>() as IVsSolutionBuildManager3; var serviceProvider = new ServiceProvider((Microsoft.VisualStudio.OLE.Interop.IServiceProvider)_dte); await TaskScheduler.Default; var commandService = await GetServiceAsync <IMenuCommandService>(); _vcProjectService = new VcProjectService(); _settingsService = new VisualStudioSettingsService(this); _errorListService = new ErrorListService(); _conanService = new ConanService(_settingsService, _errorListService, _vcProjectService); await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); _addConanDependsProject = new AddConanDependsProject(commandService, _errorListService, _vcProjectService, _conanService); _addConanDependsSolution = new AddConanDependsSolution(commandService, _errorListService, _vcProjectService, _conanService); _conanOptions = new ConanOptions(commandService, _errorListService, ShowOptionPage); _conanAbout = new ConanAbout(commandService, _errorListService); await TaskScheduler.Default; Logger.Initialize(serviceProvider, "Conan"); await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); SubscribeToEvents(); EnableMenus(_dte.Solution != null && _dte.Solution.IsOpen); await TaskScheduler.Default; }
/// <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 async System.Threading.Tasks.Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress) { await base.InitializeAsync(cancellationToken, progress); _dte = await GetServiceAsync <DTE>(); await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); _solution = await GetServiceAsync <SVsSolution>() as IVsSolution; _solutionBuildManager = await GetServiceAsync <IVsSolutionBuildManager>() as IVsSolutionBuildManager3; var serviceProvider = new ServiceProvider((Microsoft.VisualStudio.OLE.Interop.IServiceProvider)_dte); await TaskScheduler.Default; var commandService = await GetServiceAsync <IMenuCommandService>(); _vcProjectService = new VcProjectService(); _settingsService = new VisualStudioSettingsService(this); _errorListService = new ErrorListService(); _conanService = new ConanService(_settingsService, _errorListService, _vcProjectService); await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); _solutionEventsHandler = new SolutionEventsHandler(this); _solution.AdviseSolutionEvents(_solutionEventsHandler, out var _solutionEventsCookie); _addConanDependsProject = new AddConanDependsProject(commandService, _errorListService, _vcProjectService, _conanService); _addConanDependsSolution = new AddConanDependsSolution(commandService, _errorListService, _vcProjectService, _conanService); _addConanDependsConanfile = new AddConanDependsConanfile(commandService, _errorListService, _vcProjectService, _conanService); _conanOptions = new ConanOptions(commandService, _errorListService, ShowOptionPage); await TaskScheduler.Default; Logger.Initialize(serviceProvider, "Conan"); await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); SubscribeToEvents(); EnableMenus(_dte.Solution != null && _dte.Solution.IsOpen); await TaskScheduler.Default; }