示例#1
0
        private void InstallStatusUpdatedHandler(object sender, InstallStatusEventArgs e)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("{0}: ", e.InstallerContext.ProductName);

            switch (e.InstallerContext.InstallationState)
            {
            case InstallationState.Waiting:
                sb.Append("please wait...").AppendLine();
                break;

            case InstallationState.Downloading:
                sb.Append("downloading").AppendLine();
                if (e.ProgressValue > 0)
                {
                    sb.AppendFormat("{0} of {1} Kb downloaded", e.ProgressValue,
                                    e.InstallerContext.Installer.InstallerFile.FileSize);
                    sb.AppendLine();
                }
                break;

            case InstallationState.Downloaded:
                sb.Append("downloaded").AppendLine();
                break;

            case InstallationState.DownloadFailed:
                sb.AppendFormat("download failed").AppendLine();
                sb.AppendLine(e.InstallerContext.InstallStateDetails);
                break;

            case InstallationState.DependencyFailed:
                sb.AppendFormat("dependency failed").AppendLine();
                sb.AppendLine(e.InstallerContext.InstallStateDetails);
                sb.AppendFormat("{0}: {1}", e.InstallerContext.ReturnCode.Status, e.InstallerContext.ReturnCode.DetailedInformation).AppendLine();
                break;

            case InstallationState.Installing:
                sb.Append("installing").AppendLine();
                break;

            case InstallationState.InstallCompleted:
                sb.Append("install completed").AppendLine();
                break;

            case InstallationState.Canceled:
                sb.AppendFormat("canceled").AppendLine();
                sb.AppendLine(e.InstallerContext.InstallStateDetails);
                sb.AppendFormat("{0}: {1}", e.InstallerContext.ReturnCode.Status, e.InstallerContext.ReturnCode.DetailedInformation).AppendLine();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            lock (_lock)
            {
                _statusMessage = sb.ToString();
            }
        }
示例#2
0
 private void InstallStatusUpdatedHandler(object sender, InstallStatusEventArgs installStatusEventArgs)
 {
     Log.WriteInfo("Application {0} installation status: {1}, return code: {0}",
                   installStatusEventArgs.InstallerContext.ProductName,
                   installStatusEventArgs.InstallerContext.InstallationState,
                   installStatusEventArgs.InstallerContext.ReturnCode);
 }
示例#3
0
 public void HanlderInstallerStatusUpdated(object sender, InstallStatusEventArgs e)
 {
     sb.AppendFormat("{0}: {1}. {2} Progress: {3}",
                     e.InstallerContext.ProductName,
                     e.InstallerContext.InstallationState,
                     e.InstallerContext.ReturnCode.DetailedInformation,
                     e.ProgressValue).AppendLine();
 }
示例#4
0
 private void InstallManager_InstallerStatusUpdated(object sender, InstallStatusEventArgs e)
 {
     //Log(string.Format("{0}: {1}. {2} Progress: {3}",
     //    e.InstallerContext.ProductName,
     //    e.InstallerContext.InstallationState,
     //    e.InstallerContext.ReturnCode.DetailedInformation,
     //    e.ProgressValue));
 }
        private void InstallerStatusUpdated(object sender, InstallStatusEventArgs e)
        {
            string productName = e.InstallerContext.Id;

            switch (e.InstallerContext.InstallationState)
            {
            case InstallationState.Canceled:
            case InstallationState.DependencyFailed:
            case InstallationState.DownloadFailed:
                _installControl.UpdateInstallStatus(productName, "Failed to Download");
                LogInformation("Failed to download: {0}", productName);
                break;

            case InstallationState.Downloading:
                _installControl.UpdateInstallStatus(productName, "Downloading");
                LogInformation("Downloading: {0}", productName);
                break;

            case InstallationState.Downloaded:
                _installControl.UpdateInstallStatus(productName, "Download complete");
                LogInformation("Download complete: {0}", productName);
                break;

            case InstallationState.Installing:
                _installControl.UpdateInstallStatus(productName, "Installing");
                LogInformation("Installing: {0}", productName);
                break;

            case InstallationState.InstallCompleted:
                _installControl.UpdateInstallStatus(productName, "Installed", true);
                LogInformation("Installed: {0}", productName);
                break;
            }

            // Reboot-related events
            if (e.InstallerContext.ReturnCode.Status == InstallReturnCodeStatus.SuccessRebootRequired ||
                e.InstallerContext.ReturnCode.Status == InstallReturnCodeStatus.FailureRebootRequired)
            {
                this.IsRebootNeeded = true;
                _installControl.UpdateInstallStatus(productName, "Reboot required", true);
                LogInformation("Reboot required: {0}", productName);
            }
        }
示例#6
0
        private void OnProductInstallerStatusUpdated(object sender, InstallStatusEventArgs e)
        {
            var installerContext = e.InstallerContext;
            InstalledProduct product;

            var msDeployPackage = e.InstallerContext.Installer.MSDeployPackage;

            if (!Packages.TryGetValue(installerContext.ProductName, out product))
            {
                product = new InstalledProduct
                {
                    Name      = installerContext.ProductName,
                    ProductId = installerContext.Id
                };
                Packages.Add(installerContext.ProductName, product);
            }

            if (msDeployPackage != null)
            {
                product.IsWebSite  = true;
                product.Parameters = msDeployPackage.SetParameters;
                product.Site       = msDeployPackage.Site;
                product.AppPath    = msDeployPackage.AppPath;

                if (installerContext.InstallationState == InstallationState.Installing && !_iisDefaultsApplied)
                {
                    ConfigureAppPoolDefaults();
                    _iisDefaultsApplied = true;
                }
            }

            product.Message = installerContext.InstallStateDetails;
            product.Status  = installerContext.ReturnCode.Status == InstallReturnCodeStatus.None
                ? installerContext.InstallationState.ToString()
                : installerContext.ReturnCode.Status.ToString();

            switch (e.InstallerContext.ReturnCode.Status)
            {
            case InstallReturnCodeStatus.Success:
                break;

            case InstallReturnCodeStatus.SuccessRebootRequired:
                product.RequiresReboot = true;
                break;

            case InstallReturnCodeStatus.Failure:
                product.HasError = true;
                IsError          = true;
                if (string.IsNullOrWhiteSpace(e.InstallerContext.ReturnCode.DetailedInformation))
                {
                    product.Message = e.InstallerContext.ReturnCode.DetailedInformation;
                    Log.Error(product.ProductId + ": " + product.Message);
                }
                else
                {
                    Log.Error(product.ProductId + ": " + "Error reason could not be determined");
                }
                break;

            case InstallReturnCodeStatus.FailureRebootRequired:
                product.RequiresReboot = true;
                product.HasError       = true;
                IsError = true;
                if (string.IsNullOrWhiteSpace(e.InstallerContext.ReturnCode.DetailedInformation))
                {
                    product.Message = e.InstallerContext.ReturnCode.DetailedInformation;
                    Log.Error(product.ProductId + ": " + product.Message);
                }
                else
                {
                    Log.Error(product.ProductId + ": " + "Error reason could not be determined");
                }
                break;

            case InstallReturnCodeStatus.None:
                break;
            }

            if (ProductInstallerStatusUpdated != null)
            {
                ProductInstallerStatusUpdated(sender, e);
            }
        }
示例#7
0
 public void HanlderInstallerStatusUpdated(object sender, InstallStatusEventArgs e)
 {
     sb.AppendFormat("{0}: {1}. {2} Progress: {3}",
                     e.InstallerContext.ProductName,
                     e.InstallerContext.InstallationState,
                     e.InstallerContext.ReturnCode.DetailedInformation,
                     e.ProgressValue).AppendLine();
 }
示例#8
0
 private void InstallManager_InstallerStatusUpdated(object sender, InstallStatusEventArgs e)
 {
     //Log(string.Format("{0}: {1}. {2} Progress: {3}",
     //    e.InstallerContext.ProductName,
     //    e.InstallerContext.InstallationState,
     //    e.InstallerContext.ReturnCode.DetailedInformation,
     //    e.ProgressValue));
 }
        private void InstallerStatusUpdated(object sender, InstallStatusEventArgs e)
        {
            string productName = e.InstallerContext.Id;
            switch (e.InstallerContext.InstallationState)
            {
                case InstallationState.Canceled:
                case InstallationState.DependencyFailed:
                case InstallationState.DownloadFailed:
                    _installControl.UpdateInstallStatus(productName, "Failed to Download");
                    LogInformation("Failed to download: {0}", productName);
                    break;
                case InstallationState.Downloading:
                    _installControl.UpdateInstallStatus(productName, "Downloading");
                    LogInformation("Downloading: {0}", productName);
                    break;
                case InstallationState.Downloaded:
                    _installControl.UpdateInstallStatus(productName, "Download complete");
                    LogInformation("Download complete: {0}", productName);
                    break;
                case InstallationState.Installing:
                    _installControl.UpdateInstallStatus(productName, "Installing");
                    LogInformation("Installing: {0}", productName);
                    break;
                case InstallationState.InstallCompleted:
                    _installControl.UpdateInstallStatus(productName, "Installed", true);
                    LogInformation("Installed: {0}", productName);
                    break;
            }

            // Reboot-related events
            if (e.InstallerContext.ReturnCode.Status == InstallReturnCodeStatus.SuccessRebootRequired ||
                e.InstallerContext.ReturnCode.Status == InstallReturnCodeStatus.FailureRebootRequired)
            {
                this.IsRebootNeeded = true;
                _installControl.UpdateInstallStatus(productName, "Reboot required", true);
                LogInformation("Reboot required: {0}", productName);
            }
        }