bool CanInstallPackage() { IEnumerable <IPackage> packages = GetPackagesRequiringLicenseAcceptance(); if (packages.Any()) { return(licenseAcceptanceService.AcceptLicenses(packages)); } return(true); }
protected override bool OnAcceptLicenses(IEnumerable <IPackage> packages) { if (LicensesMustBeAccepted) { return(licenseAcceptanceService.AcceptLicenses(packages)); } else { return(base.OnAcceptLicenses(packages)); } }
async Task AcceptLicenses( IEnumerable <NuGetProjectAction> actions, CancellationToken cancellationToken) { var licenses = await GetPackagesWithLicences(actions, cancellationToken); licenses = RemovePackagesAlreadyInstalled(licenses); if (licenses.Any()) { if (!await licenseAcceptanceService.AcceptLicenses(licenses)) { throw new ApplicationException(GettextCatalog.GetString("Licenses not accepted.")); } } }
void AcceptLicenses(object sender, AcceptLicensesEventArgs e) { e.IsAccepted = licenseAcceptanceService.AcceptLicenses(e.Packages); }