예제 #1
0
        bool CanInstallPackage()
        {
            IEnumerable <IPackage> packages = GetPackagesRequiringLicenseAcceptance();

            if (packages.Any())
            {
                return(licenseAcceptanceService.AcceptLicenses(packages));
            }
            return(true);
        }
예제 #2
0
 protected override bool OnAcceptLicenses(IEnumerable <IPackage> packages)
 {
     if (LicensesMustBeAccepted)
     {
         return(licenseAcceptanceService.AcceptLicenses(packages));
     }
     else
     {
         return(base.OnAcceptLicenses(packages));
     }
 }
예제 #3
0
        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);
 }