/// <summary>Initializes the singleton instance of the command.</summary> /// <param name="package">Owner package, not null.</param> /// <returns>A task representing the async work of command initialization.</returns> public static async System.Threading.Tasks.Task InitializeAsync(ThemeSwitcherPackage package) { OleMenuCommandService menuCommandService; // Switch to the main thread - the call to AddCommand in Command1's constructor requires // the UI thread. await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken); #pragma warning disable VSSDK006 // Check services exist menuCommandService = (OleMenuCommandService)await package.GetServiceAsync(typeof(IMenuCommandService)).ConfigureAwait(continueOnCapturedContext: false); #pragma warning restore VSSDK006 // Check services exist Instance = new SwitchThemeAndWindowLayoutCommand(package, menuCommandService); }
/// <inheritdoc /> protected override async System.Threading.Tasks.Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress) { await base.InitializeAsync(cancellationToken, progress).ConfigureAwait(continueOnCapturedContext: false); await SwitchThemeAndWindowLayoutCommand.InitializeAsync(this).ConfigureAwait(continueOnCapturedContext: false); }