public static async Task InitializeAsync(AsyncPackage package) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken); OleMenuCommandService commandService = await package.GetServiceAsync((typeof(IMenuCommandService))) as OleMenuCommandService; Instance = new BuildNotifyCommand(package, commandService); }
protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress) { var dte = GetGlobalService(typeof(DTE)) as DTE2; await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); BuildEvents = dte.Events.BuildEvents; BuildEvents.OnBuildDone += OnSolutionBuildDone; BuildEvents.OnBuildProjConfigDone += OnProjectBuildDone; _logger = new Logger(this); _exceptionHandler = new ExceptionHandler(this, _logger); await BuildNotifyCommand.InitializeAsync(this); }