public UninstallCommand(IInstallService service, SelfPackageConfiguration selfPackageConfiguration) { Ensure.NotNull(service, "service"); Ensure.NotNull(selfPackageConfiguration, "selfPackageConfiguration"); this.service = service; this.selfPackageConfiguration = selfPackageConfiguration; }
public RefreshUpdatesCommand(UpdatesViewModel viewModel, IPackageSourceSelector packageSource, IInstallService installService, ISearchService searchService, SelfPackageConfiguration selfPackageConfiguration, IComparer <IPackageIdentity> packageVersionComparer) { Ensure.NotNull(viewModel, "viewModel"); Ensure.NotNull(packageSource, "packageSource"); Ensure.NotNull(installService, "installService"); Ensure.NotNull(searchService, "searchService"); Ensure.NotNull(selfPackageConfiguration, "selfPackageConfiguration"); Ensure.NotNull(packageVersionComparer, "packageVersionComparer"); this.viewModel = viewModel; this.packageSource = packageSource; this.installService = installService; this.searchService = searchService; this.selfPackageConfiguration = selfPackageConfiguration; this.packageVersionComparer = packageVersionComparer; }
private UpdatesViewModel CreateUpdatesViewModel() { var log = new DefaultLog(); var contentService = new NuGetPackageContentService(log); var packageSources = new NuGetPackageSourceCollection(new PackageSourceProvider(new Settings(Environment.CurrentDirectory))); var packageSourceSelector = new AllPackageSourceSelector(packageSources); var versionService = new NuGetPackageVersionService(contentService, log); var repositoryFactory = new NuGetSourceRepositoryFactory(); var installService = new NuGetInstallService(repositoryFactory, log, Args.Path, contentService, versionService); var searchService = new NuGetSearchService(repositoryFactory, log, contentService, versionService); var selfPackageConfiguration = new SelfPackageConfiguration(Args.SelfPackageId); var selfUpdateService = new SelfUpdateService(this, new ProcessService(this, Array.Empty <string>())); UpdatesViewModel viewModel = new UpdatesViewModel(packageSourceSelector, installService, searchService, selfPackageConfiguration, selfUpdateService, NuGetPackageVersionComparer.Instance); return(viewModel); }
protected override void OnStartup(StartupEventArgs e) { MemoryLogSerializer = new MemoryLogSerializer(new DefaultLogFormatter()); LogFactory = new DefaultLogFactory("root") .AddConsole() .AddSerializer(MemoryLogSerializer); ILog log = LogFactory.Scope("Startup"); log.Debug($"Startup arguments: {Environment.NewLine}{String.Join(" ", e.Args)}"); log.Debug($"Current version: {VersionInfo.Version}"); Args = new Args(e.Args); ProcessService = new ProcessService(this, Args.ProcessNamesToKillBeforeChange ?? new string[0]); Navigator = new Navigator(this, this, this); BuildExceptionHandler(); if (!Directory.Exists(Args.Path)) { Navigator.Notify("Packages", "Missing argument '--path' - a target path to install packages to.", Navigator.MessageType.Error); Shutdown(); return; } base.OnStartup(e); PackageSources = new NuGetPackageSourceCollection(new PackageSourceProvider(new Settings(Args.Path))); IReadOnlyCollection <NuGetFramework> frameworks = ParseMonikers(Args.Monikers); NuGetSourceRepositoryFactory repositoryFactory = new NuGetSourceRepositoryFactory(); INuGetPackageFilter packageFilter = null; if (Args.Dependencies.Any()) { packageFilter = new DependencyNuGetPackageFilter(Args.Dependencies, frameworks); } NuGetPackageContent.IFrameworkFilter frameworkFilter = null; if (Args.Monikers.Any()) { frameworkFilter = new NuGetFrameworkFilter(frameworks); } var selfPackageConfiguration = new SelfPackageConfiguration(Args.SelfPackageId); SelfPackageConverter.Configuration = selfPackageConfiguration; var contentService = new NuGetPackageContentService(log, frameworkFilter); var versionService = new NuGetPackageVersionService(contentService, log, packageFilter, frameworkFilter); var searchService = new NuGetSearchService(repositoryFactory, LogFactory.Scope("Search"), contentService, versionService, packageFilter, frameworkFilter); var installService = new NuGetInstallService(repositoryFactory, LogFactory.Scope("Install"), Args.Path, contentService, versionService, packageFilter, frameworkFilter); var selfUpdateService = new SelfUpdateService(this, ProcessService); EnsureSelfPackageInstalled(installService); var viewModel = new MainViewModel( PackageSources, searchService, installService, selfPackageConfiguration, selfUpdateService, NuGetPackageVersionComparer.Instance ); var wnd = new MainWindow(viewModel, ProcessService, Navigator); wnd.Show(); if (Args.IsSelfUpdate) { RunSelfUpdate(wnd); } }
public UpdatesViewModel(IPackageSourceSelector packageSource, IInstallService installService, ISearchService searchService, SelfPackageConfiguration selfPackageConfiguration, ISelfUpdateService selfUpdate, IComparer <IPackageIdentity> packageVersionComparer) { Ensure.NotNull(installService, "service"); Ensure.NotNull(searchService, "searchService"); Packages = new ObservableCollection <PackageUpdateViewModel>(); Refresh = new RefreshUpdatesCommand(this, packageSource, installService, searchService, selfPackageConfiguration, packageVersionComparer); Update = new UpdateCommand(installService, selfUpdate); UpdateAll = new UpdateAllCommand(this); }
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; }
public InstalledViewModel(IPackageSourceSelector packageSource, IInstallService service, SelfPackageConfiguration selfPackageConfiguration) { Ensure.NotNull(service, "service"); this.service = service; Packages = new ObservableCollection <IInstalledPackage>(); Refresh = new RefreshInstalledCommand(this, packageSource, service); Reinstall = new ReinstallCommand(service, selfPackageConfiguration); Uninstall = new UninstallCommand(service, selfPackageConfiguration); UninstallAll = new UninstallAllCommand(this); }