Exemple #1
0
        private void Install()
        {
            backToSettingsButton.Enabled = false;
            finishButton.Enabled = false;

            var installer = new Installer();

            var installActions = installer.GetInstallActions();

            try
            {
                foreach (var installAction in installActions)
                {
                    switch (installAction)
                    {
                        case InstallAction.StopAuditingService:
                            UpdateInstallStatus("Stopping Auditing Service...");
                            break;
                        case InstallAction.StartAuditingService:
                            UpdateInstallStatus("Starting Auditing Service...");
                            break;
                        case InstallAction.CopyApplicationFiles:
                            UpdateInstallStatus("Copying Application Files...");
                            break;
                        case InstallAction.CreateAdminServicesInstance:
                            UpdateInstallStatus("Creating Admin Services Instance...");
                            break;
                        case InstallAction.TestAdminServicesInstance:
                            UpdateInstallStatus("Testing Admin Services Instance...");
                            break;
                        case InstallAction.InstallAuditingService:
                            UpdateInstallStatus("Installing Auditing Service...");
                            break;
                        case InstallAction.CreateDefaultServicesInstance:
                            UpdateInstallStatus("Creating Default Services Instance...");
                            break;
                        case InstallAction.UpgradeServicesInstances:
                            UpdateInstallStatus("Upgrading Services Instances...");
                            break;
                        case InstallAction.TestDefaultServicesInstance:
                            UpdateInstallStatus("Testing Default Services Instance...");
                            break;
                    }

                    Application.DoEvents();

                    installer.ExecuteInstallAction(installAction);
                    installStatusTextBox.Text += "Done";
                }
                UpdateInstallStatus("");
                UpdateInstallStatus("Installation Completed Successfully!");
                finishButton.Enabled = true;
            }
            catch (Exception ex)
            {
                UpdateInstallStatus(string.Empty);
                UpdateInstallStatus("ERROR: " + ex.Message);
                UpdateInstallStatus("Please check the logs for more information");
            }
            finally
            {
                backToSettingsButton.Enabled = true;
            }
        }