public void Launch()
        {
            Process runningTool = GetRunningExternalToolProcess();

            bool isLaunchAllowed = this.isMultiExecAllowed || (runningTool == null);

            if (isLaunchAllowed)
            {
                if (CheckToolAvailability())
                {
                    LaunchProcess();
                }
            }
            else
            {
                MessageBox.Show(this.externalToolDesc + " process is running.", this.externalToolDesc);

                foreach (Process proc in JavaProcessUtil.GetProcessesByTitle(externalToolDesc))
                {
                    ShowWindow(proc.MainWindowHandle, 0x09);
                    SetForegroundWindow(proc.MainWindowHandle);
                }

                ShowWindow(runningTool.MainWindowHandle, 0x09);
                SetForegroundWindow(runningTool.MainWindowHandle);
            }
        }
Example #2
0
        public bool LaunchInstaller()
        {
            try
            {
                using (Process launcher = new Process())
                {
                    launcher.StartInfo.FileName        = downloadedInstallerPath;
                    launcher.StartInfo.Arguments       = "--automatic-installation \"" + ToolsPathInfo.ToolsRootPath + "\"";
                    launcher.StartInfo.UseShellExecute = true;
                    launcher.StartInfo.WindowStyle     = ProcessWindowStyle.Hidden;
                    launcher.StartInfo.Verb            = "runas";
                    //launcher.Exited += OnInstallerExited;
                    launcher.Start();
                    launcher.WaitForExit();

                    if (launcher.ExitCode == 0)
                    {
                        Process installerWindow = JavaProcessUtil.GetLastProcessByTitleAwait(launcher, InstallerTitle);
                        JavaProcessUtil.AttachExitEvent(installerWindow, OnInstallerExited);

                        //CLIExecutor ex = new CLIExecutor(proc, waitDialogDesc, null, OnInstallerCanceled, OnInstallerExited);
                        //IsInstallingNow = ex.Execute();

                        return(true);
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("Failed to install Tizen tools : " + e.Message, InstallerTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            return(false);
        }