/// <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 Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress) { // Switches to the UI thread in order to consume some services used in command initialization await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); await RegisterVsServicesAsync(); TaskErrorViewModel.Errors.Clear(); SquiggleViewModel.Squiggles.Clear(); mCommandController = new CommandController(this); CommandTestUtility.CommandController = mCommandController; var vsOutputWindow = VsServiceProvider.GetService(typeof(SVsOutputWindow)) as IVsOutputWindow; mOutputWindowController = new OutputWindowController(); mOutputWindowController.Initialize(this, vsOutputWindow); mRunningDocTableEvents = new RunningDocTableEvents(this); mErrorWindowController = new ErrorWindowController(this); #region Get Pointer to IVsSolutionEvents if (VsServiceProvider.TryGetService(typeof(SVsSolution), out object vsSolutionService)) { var vsSolution = vsSolutionService as IVsSolution; UnadviseSolutionEvents(vsSolution); AdviseSolutionEvents(vsSolution); } #endregion // Get the build and command events from DTE if (VsServiceProvider.TryGetService(typeof(DTE), out object dte)) { var dte2 = dte as DTE2; mBuildEvents = dte2.Events.BuildEvents; mCommandEvents = dte2.Events.CommandEvents; mDteEvents = dte2.Events.DTEEvents; } mSettingsHandler = new SettingsHandler(); mSettingsHandler.InitializeSettings(); await mCommandController.InitializeCommandsAsync(this); mSettingsProvider = new SettingsProvider(); RegisterToEvents(); LicenseController mLicenseController = new LicenseController(); await mLicenseController.CheckLicenseAsync(); await base.InitializeAsync(cancellationToken, progress); }
/// <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 Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress) { // Switches to the UI thread in order to consume some services used in command initialization await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); await RegisterVsServicesAsync(); mCommandController = new CommandController(this); CommandTestUtility.CommandController = mCommandController; var vsOutputWindow = VsServiceProvider.GetService(typeof(SVsOutputWindow)) as IVsOutputWindow; mOutputWindowController = new OutputWindowController(); mOutputWindowController.Initialize(this, vsOutputWindow); mRunningDocTableEvents = new RunningDocTableEvents(this); mErrorWindowController = new ErrorWindowController(this); #region Get Pointer to IVsSolutionEvents if (VsServiceProvider.TryGetService(typeof(SVsSolution), out object vsSolutionService)) { var vsSolution = vsSolutionService as IVsSolution; UnadviseSolutionEvents(vsSolution); AdviseSolutionEvents(vsSolution); } #endregion // Get-Set the build and command events from DTE if (VsServiceProvider.TryGetService(typeof(DTE), out object dte)) { var dte2 = dte as DTE2; mBuildEvents = dte2.Events.BuildEvents; mCommandEvents = dte2.Events.CommandEvents; mDteEvents = dte2.Events.DTEEvents; windowEvents = dte2.Events.WindowEvents; } var settingsHandler = new SettingsHandler(); settingsHandler.InitializeSettings(); await settingsHandler.InitializeAccountSettingsAsync(); string version = SettingsProvider.GeneralSettingsModel.Version; ShowToolbar(version); UpdateVersion(version); //.SafeFireAndForget(); await mCommandController.InitializeCommandsAsync(this); RegisterToEvents(); await base.InitializeAsync(cancellationToken, progress); }