public void SetupInstall(string[] productList) { _hasInstallers = false; _installControl = null; _installManager = new InstallManager(); _productList = new List<string>(); _installManager.InstallerStatusUpdated += new EventHandler<InstallStatusEventArgs>(InstallerStatusUpdated); _installManager.InstallCompleted += new EventHandler<EventArgs>(InstallerCompletedCallback); var productManager = new ProductManager(); // Load feed specifying that enclosure files are needed. productManager.Load(new Uri(WebPiFeedUrl), true, true, false, Path.GetTempPath()); var productsToInstall = new List<Product>(); var uniqueInstallerList = new Dictionary<string, Installer>(StringComparer.OrdinalIgnoreCase); var languageOfInstallers = productManager.GetLanguage(Thread.CurrentThread.CurrentCulture.ToString()); var english = productManager.GetLanguage("en"); foreach (var productName in productList) { Product product = productManager.GetProduct(productName); LogInformation("Initial Product to install: {0}", product.ProductId); if (!product.IsInstalled(true)) { AddProductWithDependencies(product, productsToInstall); foreach (Product productToInstall in productsToInstall) { Installer currentInstaller = productToInstall.GetInstaller(languageOfInstallers); if (currentInstaller == null) { currentInstaller = productToInstall.GetInstaller(english); } if (currentInstaller != null) { if (!uniqueInstallerList.ContainsKey(currentInstaller.Product.ProductId)) { uniqueInstallerList[currentInstaller.Product.ProductId] = currentInstaller; LogInformation("Adding product: {0}", currentInstaller.Product.ProductId); _productList.Add(currentInstaller.Product.ProductId); } _hasInstallers = true; } } } } if (_hasInstallers) { _installManager.Load(uniqueInstallerList.Values); } }
public abstract void BeginInstall(InstallerControl control);
public override void BeginInstall(InstallerControl control) { if (_hasInstallers) { _installControl = control; _installManager.StartInstallation(); WaitForInstallationToComplete(); } }