Пример #1
0
        public InstallDialogViewModel(Dispatcher dispatcher, ILibraryCommandService libraryCommandService, string configFileName, IDependencies deps, string targetPath, Action <bool> closeDialog, Project project)
        {
            _libraryCommandService = libraryCommandService;
            _configFileName        = configFileName;
            _targetPath            = targetPath;
            _deps              = deps;
            _dispatcher        = dispatcher;
            _closeDialog       = closeDialog;
            _anyFileSelected   = false;
            _isTreeViewEmpty   = true;
            _libraryNameChange = new BindLibraryNameToTargetLocation();
            _project           = project;

            List <IProvider> providers = new List <IProvider>();

            foreach (IProvider provider in deps.Providers.OrderBy(x => x.Id))
            {
                ILibraryCatalog catalog = provider.GetCatalog();

                if (catalog == null)
                {
                    continue;
                }

                if (_catalog == null)
                {
                    _activeProvider = provider;
                    _catalog        = catalog;
                }

                providers.Add(provider);
            }

            Providers             = providers;
            InstallPackageCommand = ActionCommand.Create(InstallPackage, CanInstallPackage, false);
            Task t = LoadPackagesAsync();
        }