Esempio n. 1
0
        /// <summary>
        /// private void show_finished()
        /// Calls Finished form with parameter defined by "finished" value to show
        /// Finished form with proper message
        /// </summary>
        private void show_finished()
        {
            switch (finished)
            {
            case 0:
                st = "failed";
                break;

            case 1:
                st = "complete";
                break;

            case 2:
                st = "cancelled";
                tokenSource.Cancel();
                break;

            case 3:
                st = "failed";
                break;
            }

            logger.Info("show finished = {0}", finished);
            Program.form1.Visible = false;
            InstallationFinished form2 = new InstallationFinished(st, Program.inst_Dir);

            if (finished != 11)
            {
                if (finished == 1)
                {
                    finished = 11;
                    logger.Info("will show form2 completed");
                    form2.Show();
                }
                else
                {
                    finished = 11;
                    logger.Info("will show form2 failed");
                    form2.ShowDialog();
                }
            }
        }
Esempio n. 2
0
        //[STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            AppDomain current_domain = AppDomain.CurrentDomain;

            Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

            //Add installation type command line parameter to parameter string
            inst_type = InstType(cmd_args[1]);
            string repo_desc        = cmd_args[2];
            string if_installer_run = cmd_args[3];
            string kurjunURL        = cmd_args[4];

            inst_args = $"type={inst_type} network-installation=true kurjunUrl={kurjunURL} repo_descriptor={repo_desc}";

            logger.Info("Argument string: {0}", inst_args);
            //Check if_installer_run - if "Installer", will run application in new process - to close installer

            if (if_installer_run.Equals("Installer"))
            {
                ProcessStartInfo startInfo = new ProcessStartInfo();
                startInfo.UseShellExecute  = true;
                startInfo.WorkingDirectory = Environment.CurrentDirectory;
                startInfo.FileName         = Application.ExecutablePath;
                startInfo.Arguments        = $"{cmd_args[1]} {cmd_args[2]} Run {kurjunURL}";
                startInfo.Verb             = "runas";
                try
                {
                    Thread.Sleep(3000);
                    Process p = Process.Start(startInfo);
                    Environment.Exit(0);
                }
                catch (System.ComponentModel.Win32Exception)
                {
                    MessageBox.Show("This utility requires elevated priviledges to complete correctly.", "Error: UAC Authorisation Required", MessageBoxButtons.OK);
                    return;
                }
            }
            inst_Dir = Inst.subutai_path();
            form_    = new f_confirm();
            form_.ShowDialog();
            if (stRun)
            {
                form1 = new f_install(inst_args);
                form2 = new InstallationFinished("complete", "");

                Application.Run(form1);
            }
            else
            {
                if (inst_Dir.Equals("") || inst_Dir.Equals("\"\""))
                {
                    inst_Dir = Inst.subutai_path();
                }

                string cmd = $"{inst_Dir}bin\\uninstall-clean.exe";
                cmd = FD.path_with_commas(cmd);
                var startInfo = new ProcessStartInfo
                {
                    CreateNoWindow  = true,
                    UseShellExecute = false,
                    FileName        = cmd,
                    WindowStyle     = ProcessWindowStyle.Hidden,
                    Arguments       = "Silent NoAll"
                };
                var exeProcess = Process.Start(startInfo);
                Environment.Exit(1);
            }
        }