public static bool IsSolutionInstalled(StorePackage package, SPWeb targetWeb)
        {
            bool isInstalled = false;

            if (package.SolutionType == SolutionType.Farm)
            {
                try
                {
                    Assembly         a         = Assembly.Load(pakcageInstallerAssemblies[SolutionType.Farm].Name.FullName);
                    PackageInstaller installer = (PackageInstaller)a.CreateInstance(pakcageInstallerAssemblies[SolutionType.Farm].Class);
                    isInstalled = installer.IsSolutionInstalled(package, targetWeb);
                }
                catch
                {
                    throw;
                }
            }
            else if (package.SolutionType == SolutionType.Sandbox)
            {
                try
                {
                    Assembly         a         = Assembly.Load(pakcageInstallerAssemblies[SolutionType.Sandbox].Name.FullName);
                    PackageInstaller installer = (PackageInstaller)a.CreateInstance(pakcageInstallerAssemblies[SolutionType.Sandbox].Class);
                    isInstalled = installer.IsSolutionInstalled(package, targetWeb);
                }
                catch
                {
                    throw;
                }
            }
            return(isInstalled);
        }
 public static void AddFarmSolution(AddPackageContext context, Boolean autoActivate)
 {
     try
     {
         Assembly         a         = Assembly.Load(pakcageInstallerAssemblies[SolutionType.Farm].Name.FullName);
         PackageInstaller installer = (PackageInstaller)a.CreateInstance(pakcageInstallerAssemblies[SolutionType.Farm].Class);
         installer.AddPackage(context, autoActivate);
     }
     catch
     {
         throw;
     }
 }