protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress) { await base.InitializeAsync(cancellationToken, progress); await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); await ApplyCustomTool.InitializeAsync(this); }
public static async Task InitializeAsync(AsyncPackage package) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken); dte = await package.GetServiceAsync(typeof(DTE)) as DTE ?? throw new ServiceUnavailableException(typeof(DTE)); var commandService = await package.GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService ?? throw new ServiceUnavailableException(typeof(OleMenuCommandService)); Instance = new ApplyCustomTool(package, commandService); }