public override Control CreatePanelWidget() { var settings = SettingsLoader.LoadDefaultSettings(reportError: true); var repositoryProvider = SourceRepositoryProviderFactory.CreateSourceRepositoryProvider(settings); viewModel = new RegisteredPackageSourcesViewModel(repositoryProvider); viewModel.Load(); packageSourcesWidget = new PackageSourcesWidget(viewModel); return(packageSourcesWidget); }
void InstallPackage(string source, Project project, string packageId, string version, bool includePrerelease, bool ignoreDependencies) { Runtime.RunInMainThread(delegate { var repositoryProvider = SourceRepositoryProviderFactory.CreateSourceRepositoryProvider(); var repository = repositoryProvider.CreateRepository(new PackageSource(source)); var action = new InstallNuGetPackageAction( new [] { repository }, PackageManagementServices.Workspace.GetSolutionManager(project.ParentSolution), new DotNetProjectProxy((DotNetProject)project), new NuGetProjectContext()) { PackageId = packageId, Version = string.IsNullOrEmpty(version) ? null : new NuGetVersion(version), IncludePrerelease = includePrerelease, IgnoreDependencies = ignoreDependencies, }; var message = ProgressMonitorStatusMessageFactory.CreateInstallingSinglePackageMessage(packageId); PackageManagementServices.BackgroundPackageActionRunner.Run(message, action); }); }