public static void _SA_StartSage50()
        {
            string sStartupLocation = Simply._SA_GetProgramPath() + Variables.sExecutable;

            Functions.LaunchAProgram(sStartupLocation);
            Thread.Sleep(1000);
        }
        public static bool _SA_Install(string sDirToInstallFrom, string serial1, string serial2, bool bServerInstall)
        {
            string sPathToInstallFrom;
            bool   bSucess = true;

            try
            {
                // Compose install path
                if (Directory.Exists(string.Format(@"{0}\Setup", sDirToInstallFrom)))
                {
                    sPathToInstallFrom = string.Format(@"{0}\Setup\setup.exe", sDirToInstallFrom);
                }
                else if (Directory.Exists(string.Format(@"{0}\cd\setup", sDirToInstallFrom)))
                {
                    sPathToInstallFrom = string.Format(@"{0}\cd\setup\setup.exe", sDirToInstallFrom);
                }
                else
                {
                    Functions.Verify(false, true, "Valid install path found");
                    bSucess = false;
                    return(bSucess);
                }

                // Start setup.exe
                Functions.LaunchAProgram(sPathToInstallFrom);

                while (!SimplyInstall.repo.SelfInfo.Exists())
                {
                    Thread.Sleep(1000);
                }

                // Select language
                SimplyInstall.repo.SelectLanguage.Select("English");
                SimplyInstall.repo.OK.Click();

                // C++ packages
                if (SimplyInstall.repo.InstallInfo.Exists())
                {
                    SimplyInstall.repo.Install.Click();

                    // Known issue: failed to install lower version C++ package, can continue install
                    int x = 1;
                    while (!SimplyInstall.repo.UninstallDialogTextInfo.Exists())
                    {
                        if (x > 60)
                        {
                            break;
                        }
                        Thread.Sleep(1000);
                        x++;
                    }
                    if (SimplyInstall.repo.UninstallDialogTextInfo.Exists())
                    {
                        if (SimplyInstall.repo.UninstallDialogText.TextValue.Contains(SimplyMessage.sInstall_FailedInstallPackage))
                        {
                            SimplyInstall.repo.Yes.Click();
                        }
                    }
                }

                // Wait for Windows update page or Firwall or Installation page
                while (!SimplyInstall.repo.YesInfo.Exists() && !SimplyInstall.repo.NextInfo.Exists())
                {
                    Thread.Sleep(300);
                }

                // If Windows update question pops up
                if (SimplyInstall.repo.SelfInfo.Exists() && SimplyInstall.repo.UninstallDialogTextInfo.Exists())
                {
                    if (SimplyInstall.repo.UninstallDialogText.TextValue.Contains(SimplyMessage.sInstall_WindowsUpdateMsg))
                    {
                        SimplyInstall.repo.Yes.Click();
                        Thread.Sleep(500);
                    }
                }

                // If Windows firewall is on
                if (SimplyInstall.repo.InstallDialogTextInfo.Exists())
                {
                    if (SimplyInstall.repo.InstallDialogText.TextValue.Contains("Firewall"))
                    {
                        SimplyInstall.repo.Next.Click();
                    }
                }

                // Installation type
                // Ranorex nullexception message when using: (SimplyInstall.repo.InstallDialogText.TextValue.Contains("Type of installation") && bServerInstall)
                if (bServerInstall && SimplyInstall.repo.AdvancedBtnInfo.Exists())
                {
                    SimplyInstall.repo.AdvancedBtn.Click();
                    SimplyInstall.repo.Next.Click();

                    // Next page
                    SimplyInstall.repo.ServerOnlyBtn.Click();
                    SimplyInstall.repo.Next.Click();

                    // Next page
                    SimplyInstall.repo.Next.Click();
                }
                else                    // Full install
                {
                    SimplyInstall.repo.Next.Click();

                    // Serial number
                    if (SimplyInstall.repo.InstallDialogText.TextValue.Contains("Product installation"))
                    {
                        SimplyInstall.repo.Serial1.TextValue = serial1;
                        SimplyInstall.repo.Serial2.TextValue = serial2;
                        SimplyInstall.repo.Next.Click();
                    }
                }

                // License agreement
                if (SimplyInstall.repo.InstallDialogText.TextValue.Contains("License agreement"))
                {
                    SimplyInstall.repo.AgreeToLicenseAgreement.Click();                     // need to use click to enable Install button
                    SimplyInstall.repo.Install.Click();
                }

                // Wait for Installation to complete
                int y = 1;
                while (!SimplyInstall.repo.FinishInfo.Exists())
                {
                    if (y > 1000)
                    {
                        bSucess = false;
                        Functions.Verify(false, true, "Install - Finish button found");
                        break;
                    }
                    Thread.Sleep(1000);
                    y++;
                }

                // Finish
                if (bServerInstall)
                {
                    SimplyInstall.repo.Finish.Click();
                    while (!InstallationGuide.repo.SelfInfo.Exists())
                    {
                        Thread.Sleep(500);
                    }
                    InstallationGuide.repo.Self.Close();
                }
                else
                {
                    SimplyInstall.repo.OpenReadMe.SetState(false);
                    SimplyInstall.repo.OpenSage50.SetState(false);
                    SimplyInstall.repo.Finish.Click();
                }
            }

            catch (Exception e)
            {
                Ranorex.Report.Info(e.Message);
                bSucess = false;
            }

            if (bSucess)
            {
                Ranorex.Report.Info(string.Format("Program installed successfully to {0}", Simply._SA_GetProgramPath()));
            }

            Functions.Verify(bSucess, true, "Program installed successfully");

            return(bSucess);
        }