public static async Task InitializeAsync(CollapseCommandPackage package) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken); OleMenuCommandService commandService = await package.GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService; Instance = new ExpandCommand(package, commandService); }
private ExpandCommand(CollapseCommandPackage 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 MenuCommand(this.Execute, menuCommandID); commandService.AddCommand(menuItem); }
public void Initialize(CollapseCommandPackage package, RunningDocumentTable runningDocumentTable, DTE2 dte) { this.package = package; this.runningDocumentTable = runningDocumentTable; this.dte = dte; }