Ejemplo n.º 1
0
 public RemoveSourceCommand(ICollection <IPackageSource> sources, IPackageSourceCollection service)
 {
     Ensure.NotNull(sources, "sources");
     Ensure.NotNull(service, "service");
     this.sources = sources;
     this.service = service;
 }
        public PackageSourceSelectorViewModel(IPackageSourceCollection service)
        {
            Ensure.NotNull(service, "service");
            this.service = service;
            SourceNames  = new ObservableCollection <string>();

            service.Changed += OnServiceChanged;
            OnServiceChanged();
        }
Ejemplo n.º 3
0
        public PackageSourceViewModel(IPackageSourceCollection service)
        {
            Ensure.NotNull(service, "service");
            this.service = service;

            Sources = new ObservableCollection <IPackageSource>(service.All);

            Add    = new DelegateCommand(OnAdd);
            Edit   = new DelegateCommand <IPackageSource>(OnEdit, CanEdit);
            Remove = new RemoveSourceCommand(Sources, service);

            MoveUp   = new MoveCommand <IPackageSource>(Sources, source => service.MoveUp(source), source => Sources.IndexOf(source) > 0);
            MoveDown = new MoveCommand <IPackageSource>(Sources, source => service.MoveDown(source), source => Sources.IndexOf(source) < Sources.Count - 1);

            Save           = new SaveSourceCommand(Sources, service);
            Save.Executed += () => IsEditActive = false;
            Cancel         = new DelegateCommand(() => IsEditActive = false);
        }
Ejemplo n.º 4
0
        public MainViewModel(IPackageSourceCollection sources, ISearchService search, IInstallService install, SelfPackageConfiguration selfPackageConfiguration, ISelfUpdateService selfUpdate, IComparer <IPackageIdentity> packageVersionComparer)
        {
            SourceSelector = new PackageSourceSelectorViewModel(sources);

            Browser   = new BrowserViewModel(SourceSelector, search, install);
            Installed = new InstalledViewModel(SourceSelector, install, selfPackageConfiguration);
            Updates   = new UpdatesViewModel(SourceSelector, install, search, selfPackageConfiguration, selfUpdate, packageVersionComparer);

            Cancel = new CancelCommand(
                Browser.Search,
                Browser.Install,
                Installed.Uninstall,
                Installed.UninstallAll,
                Installed.Reinstall,
                Installed.Refresh,
                Updates.Update,
                Updates.UpdateAll,
                Updates.Refresh
                );
            Cancel.CanExecuteChanged += OnCancelCanExecuteChanged;

            Installed.Uninstall.Completed += OnInstalledChanged;
            Updates.Update.Completed      += OnInstalledChanged;
        }