/// <summary> /// Initializes a new instance of the <see cref="PreviewWindowCommand"/> class. /// Adds our command handlers for menu (commands must exist in the command table file) /// </summary> /// <param name="package">Owner package, not null.</param> private PreviewWindowCommand(Package package, IShowAll viewModel, GeneratorManager manager) { if (package == null) { throw new ArgumentNullException("package"); } _package = package; if (viewModel == null) { throw new ArgumentNullException(nameof(viewModel)); } _viewModel = viewModel; if (manager == null) { throw new ArgumentNullException(nameof(manager)); } _manager = manager; OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (commandService != null) { var menuCommandID = new CommandID(CommandSet, CommandId); var menuItem = new MenuCommand(this.ShowToolWindow, menuCommandID); commandService.AddCommand(menuItem); } }
/// <summary> /// Initializes the singleton instance of the command. /// </summary> /// <param name="package">Owner package, not null.</param> public static void Initialize(Package package, IShowAll viewModel, GeneratorManager manager) { Instance = new PreviewWindowCommand(package, viewModel, manager); }