예제 #1
0
        /// <summary>
        /// Initializes the singleton instance of the command.
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        public static async Task InitializeAsync(AsyncPackage package)
        {
            if (package == null)
            {
                throw new ArgumentNullException(nameof(package));
            }

            var commandService = await package.GetServiceAsync(typeof(IMenuCommandService)) as IMenuCommandService;

            var vsMonitorSelection = await package.GetServiceAsync(typeof(IVsMonitorSelection)) as IVsMonitorSelection;

            var componentModel = await package.GetComponentModelAsync();

            _instance = new SolutionRestoreCommand(commandService, vsMonitorSelection, componentModel);
            componentModel.DefaultCompositionService.SatisfyImportsOnce(_instance);
        }