Example #1
0
        public InstallDialogViewModel(Dispatcher dispatcher, string configFileName, IDependencies deps, string targetPath, Action <bool> closeDialog)
        {
            _configFileName = configFileName;
            _targetPath     = targetPath;
            _deps           = deps;
            _dispatcher     = dispatcher;
            _closeDialog    = closeDialog;

            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(InstallPackageAsync, CanInstallPackage, false);
            Task t = LoadPackagesAsync();
        }
Example #2
0
        public InstallDialogViewModel(ILibraryCommandService libraryCommandService,
                                      string configFileName,
                                      IDependencies deps,
                                      LibraryIdViewModel libraryIdViewModel,
                                      TargetLocationViewModel targetLocationViewModel,
                                      SelectedProviderBinding selectedProviderBinding,
                                      LibraryNameBinding bindLibraryNameToTargetLocation,
                                      string targetPath,
                                      Project project,
                                      string initialProvider)
        {
            _libraryCommandService = libraryCommandService;
            _configFileName        = configFileName;
            _targetPath            = targetPath;
            _deps                    = deps;
            _anyFileSelected         = false;
            _isTreeViewEmpty         = true;
            _selectedProviderBinding = selectedProviderBinding;
            _libraryNameChange       = bindLibraryNameToTargetLocation;
            _project                 = project;
            _taskFactory             = new TaskFactory(TaskScheduler.FromCurrentSynchronizationContext());

            LibraryIdViewModel      = libraryIdViewModel;
            TargetLocationViewModel = targetLocationViewModel;

            var 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 || provider.Id.Equals(initialProvider, StringComparison.Ordinal))
                {
                    SelectedProvider = provider;
                    _selectedProviderBinding.SelectedProvider = SelectedProvider;
                    _catalog = catalog;
                }

                providers.Add(provider);
            }

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

            LibraryIdViewModel.PropertyChanged += LibraryIdViewModel_PropertyChanged;
        }
Example #3
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();
        }