public static async Task InitializeAsync(RazorMinifier package) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken); OleMenuCommandService commandService = await package.GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService; Instance = new ToggleRazorMinifier(package, commandService); }
private ToggleRazorMinifier(RazorMinifier package, OleMenuCommandService commandService) { this._package = package ?? throw new ArgumentNullException(nameof(package)); commandService = commandService ?? throw new ArgumentNullException(nameof(commandService)); var menuCommandID = new CommandID(CommandSet, CommandId); var menuItem = new OleMenuCommand(this.Execute, menuCommandID) { Supported = false }; commandService.AddCommand(menuItem); }