public void OnAcceptLicenses(AcceptLicensesEventArgs e)
 {
     if (AcceptLicenses != null)
     {
         SD.Log.DebugFormatted("[AddInManager2.Events] Accept license.");
         AcceptLicenses(this, e);
     }
 }
 public void OnAcceptLicenses(AcceptLicensesEventArgs e)
 {
     if (AcceptLicenses != null)
     {
         SD.Log.DebugFormatted("[AddInManager2.Events] Accept license.");
         AcceptLicenses(this, e);
     }
 }
        private bool CanInstallPackage()
        {
            // Ask for downloading dependent packages
            if ((_packageOperations != null) && _packageOperations.Any())
            {
                var operationsForDependencies = _packageOperations.Where(p => p.Package.Id != _package.Id);
                if ((operationsForDependencies != null) && operationsForDependencies.Any())
                {
                    string addInNames = "";
                    foreach (var packageOperation in operationsForDependencies)
                    {
                        addInNames += "\t " +
                            packageOperation.Package.Id + " " + packageOperation.Package.Version.ToString() + Environment.NewLine;
                    }
                    if (!MessageService.AskQuestionFormatted(
                        "${res:AddInManager.Title}", "${res:AddInManager2.InstallDependentMessage}", _package.Id, addInNames))
                    {
                        return false;
                    }
                }
            }

            // Ask for license acceptance
            IEnumerable<IPackage> packages = GetPackagesRequiringLicenseAcceptance();
            if (packages.Any())
            {
                AcceptLicensesEventArgs acceptLicenses = new AcceptLicensesEventArgs(packages);
                acceptLicenses.IsAccepted = true;
                AddInManager.Events.OnAcceptLicenses(acceptLicenses);
                return acceptLicenses.IsAccepted;
            }
            return true;
        }