Exemple #1
0
        private void backgroundWorker_Completed(object sender, RunWorkerCompletedEventArgs e)
        {
            OldOxigenUninstallReturnStatus status = (OldOxigenUninstallReturnStatus)e.Result;

            AppDataSingleton.Instance.OldOxigenSystemModified = status.SystemModified;

            if (status.Status != UninstallOlderSoftwareStatus.Success)
            {
                progressBar.Value = 100;

                switch (status.Status)
                {
                case UninstallOlderSoftwareStatus.ErrorDeletingBinaries:
                    MessageBox.Show("There was an error uninstalling Oxigen. Please state the following error code to helpdesk: 001", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    break;

                case UninstallOlderSoftwareStatus.ErrorExecutingSupport:
                    MessageBox.Show("Could not terminate existing running Oxigen product. Please close all running Oxigen programs and try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    break;

                case UninstallOlderSoftwareStatus.ErrorUninstallingMSI:
                    MessageBox.Show("Could not uninstall existing Oxigen product. Existing Oxigen must be uninstalled before Setup can install Oxigen. Please locate the Oxigen MSI that you have used to install Oxigen and double-click it to uninstall.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    break;
                }

                Application.Exit();
                return;
            }

            MessageBox.Show("Existing Oxigen product has been uninstalled from your computer.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

            SetupHelper.OpenForm <PrerequisitesForm>(this);
        }
Exemple #2
0
        /// <summary>
        /// Silently installs the application.
        /// </summary>
        internal static void Install()
        {
            AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 1");

            if (!SetupHelper.HasAdminRights())
            {
                return;
            }

            AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 2");

            if (SetupHelper.OlderOxigenExists())
            {
                Oxigen1Uninstaller             uninstaller = new Oxigen1Uninstaller();
                OldOxigenUninstallReturnStatus status      = uninstaller.Uninstall();

                if (status.Status != UninstallOlderSoftwareStatus.Success)
                {
                    return;
                }
            }

            AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 3");

            if (SetupHelper.OxigenExists())
            {
                return;
            }

            AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 4");

            if (!SetupHelper.PrerequisitesMet())
            {
                return;
            }

            AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 5");

            if (!File.Exists(Directory.GetCurrentDirectory() + "\\Oxigen.msi"))
            {
                return;
            }

            AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 6");

            string userGUID = GetUserGUIDByUsername();

            AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 7");

            if (string.IsNullOrEmpty(userGUID))
            {
                return;
            }

            AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 8");

            string machineGUID = System.Guid.NewGuid().ToString().ToUpper() + "_" + SetupHelper.GetRandomLetter();

            AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 9");

            AppDataSingleton.Instance.User.UserGUID    = userGUID;
            AppDataSingleton.Instance.User.MachineGUID = machineGUID;

            // get installation paths
            if (!GetBinaryPath())
            {
                return;
            }

            AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 10");

            if (!GetDataPath())
            {
                return;
            }

            AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 11");

            if (!SetupHelper.IsSufficientSpace(AppDataSingleton.Instance.BinariesPath, _binaryRequiredSpace))
            {
                return;
            }

            AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 12");

            if (!SetupHelper.IsSufficientSpace(AppDataSingleton.Instance.DataPath, _dataRequiredSpace))
            {
                return;
            }

            AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 13");

            CalculateMaxDiskSpaceForAssets();

            AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 14");

            if (AppDataSingleton.Instance.FileDetectedChannelSubscriptionsLocal.SubscriptionSet != null)
            {
                AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 14 - 1");
                AppDataSingleton.Instance.ChannelSubscriptionsToUpload.SubscriptionSet = SetupHelper.GetChannelSubscriptionsNetFromLocal(AppDataSingleton.Instance.FileDetectedChannelSubscriptionsLocal.SubscriptionSet);
                AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 14 - 2");
            }

            AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 15");

            try
            {
                AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 16");

                if (!InstallMSI())
                {
                    return;
                }

                AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 17");

                SetupHelper.DoPostMSIInstallSteps();

                AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 18");

                SetupHelper.CopySetup();

                AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 19");

                if (!SendDetails())
                {
                    AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 20");

                    UninstallMSI();

                    AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 21");

                    SetupHelper.RemoveAllFiles(AppDataSingleton.Instance.BinariesPath + "bin", SetupHelper.GetSystemDirectory(), AppDataSingleton.Instance.DataPath);

                    AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 22");

                    return;
                }

                AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 23");

                SetupHelper.SetRegistryForModifyUninstall();

                AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 24");
            }
            catch (Exception ex)
            {
                AppDataSingleton.Instance.SetupLogger.WriteMessage(ex.ToString());

                UninstallMSI();

                SetupHelper.RemoveAllFiles(AppDataSingleton.Instance.BinariesPath + "bin", SetupHelper.GetSystemDirectory(), AppDataSingleton.Instance.DataPath);
                return;
            }

            StartApps();
            SetScreensaver();
        }