public static async Task InitializeAsync(AsyncPackage package, MutationFilterItemCreatorService mutationFilterItemCreatorService, UserNotificationService userNotificationService) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken); OleMenuCommandService commandService = await package.GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService; Instance = new SelectProjectFileCommand(package, commandService, mutationFilterItemCreatorService, userNotificationService); }
private SelectProjectFileCommand( AsyncPackage package, OleMenuCommandService commandService, MutationFilterItemCreatorService mutationFilterItemCreatorService, UserNotificationService userNotificationService) { _package = package ?? throw new ArgumentNullException(nameof(package)); _mutationFilterItemCreatorService = mutationFilterItemCreatorService; _userNotificationService = userNotificationService; commandService = commandService ?? throw new ArgumentNullException(nameof(commandService)); var menuCommandID = new CommandID(CommandSet, CommandId); var menuItem = new MenuCommand(Execute, menuCommandID); commandService.AddCommand(menuItem); }