Esempio n. 1
0
        public ExplorerViewModel(ITypeFactory typeFactory, ICommandManager commandManager, IModelProvider <ExplorerSettingsContainer> settingsProvider,
                                 IConfigurationService configurationService, INuGetExplorerInitializationService initializationService, ISettings nuGetSettings)
        {
            Argument.IsNotNull(() => commandManager);
            Argument.IsNotNull(() => settingsProvider);
            Argument.IsNotNull(() => configurationService);
            Argument.IsNotNull(() => typeFactory);

            _configurationService  = configurationService;
            _initializationService = initializationService;
            _nuGetSettings         = nuGetSettings;
            _typeFactory           = typeFactory;

            CreateApplicationWideCommands(commandManager);

            if (settingsProvider is ExplorerSettingsContainerModelProvider settingsLazyProvider)
            {
                //force settings model re-initialization from config
                settingsLazyProvider.IsInitialized = false;
            }

            Settings = settingsProvider.Model;

            Title = "Package management";
        }
        public MainViewModel(INuGetExplorerInitializationService initializationService, IPackagesUIService packagesUiService, IEchoService echoService, INuGetConfigurationService nuGetConfigurationService,
                             INuGetFeedVerificationService feedVerificationService, IMessageService messageService, IPackagesUpdatesSearcherService packagesUpdatesSearcherService,
                             INuGetProjectUpgradeService nuGetProjectUpgradeService, IUIVisualizerService uiVisualizerService)
        {
            Argument.IsNotNull(() => packagesUiService);
            Argument.IsNotNull(() => echoService);
            Argument.IsNotNull(() => nuGetConfigurationService);
            Argument.IsNotNull(() => feedVerificationService);
            Argument.IsNotNull(() => messageService);
            Argument.IsNotNull(() => uiVisualizerService);
            Argument.IsNotNull(() => initializationService);
            Argument.IsNotNull(() => nuGetProjectUpgradeService);

            _initializationService          = initializationService;
            _packagesUiService              = packagesUiService;
            _nuGetConfigurationService      = nuGetConfigurationService;
            _feedVerificationService        = feedVerificationService;
            _messageService                 = messageService;
            _packagesUpdatesSearcherService = packagesUpdatesSearcherService;
            _nuGetProjectUpgradeService     = nuGetProjectUpgradeService;
            _uiVisualizerService            = uiVisualizerService;

            Echo = echoService.GetPackageManagementEcho();

            AvailableUpdates = new ObservableCollection <IPackageDetails>();

            ShowExplorer      = new TaskCommand(OnShowExplorerExecuteAsync);
            AdddPackageSource = new TaskCommand(OnAdddPackageSourceExecuteAsync, OnAdddPackageSourceCanExecute);
            VerifyFeed        = new TaskCommand(OnVerifyFeedExecuteAsync, OnVerifyFeedCanExecute);
            CheckForUpdates   = new TaskCommand(OnCheckForUpdatesExecuteAsync);
            OpenUpdateWindow  = new TaskCommand(OnOpenUpdateWindowExecuteAsync, OnOpenUpdateWindowCanExecute);
            Settings          = new TaskCommand(OnSettingsExecuteAsync);

            Title = "Orc.NuGetExplorer example";
        }