Ejemplo n.º 1
0
        // need to convert to Tool_API format (this will uninstall
        public bool install()
        {
            "Installing {0}".info(ToolName);
            var downloadUrl = "http://downloads.sourceforge.net/project/gitextensions/Git%20Extensions/Version%202.17/GitExtensions217Setup.msi?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fgitextensions%2Ffiles%2FGit%2520Extensions%2FVersion%25202.17%2F&ts=1300699408&use_mirror=netcologne";
            var targetDir   = @"..\_O2Downloads".tempDir(false).fullPath();
            var targetFile  = targetDir.pathCombine(downloadUrl.uri().Segments.Last());

            downloadUrl.download(targetFile);
            var process       = targetFile.startProcess();
            var guiAutomation = new API_GuiAutomation(process);

            guiAutomation.button("Next").click();
            if (guiAutomation.hasButton("Repair"))
            {
                "App is already installed".error();
                if (unInstallIfAlreadyInstalled)
                {
                    guiAutomation.button("Repair").click();
                    guiAutomation.button("Next").click();
                    guiAutomation.button("Finish", 20).click();
                }
            }
            else
            {
                guiAutomation.button("Next").click();
                guiAutomation.button("Next").click();
                guiAutomation.button("Next").click();
                guiAutomation.button("Next").click();
                guiAutomation.button("Install").click();
                guiAutomation.button("Finish", 20).click();
            };
            return(false);
        }
 public static Button button(this API_GuiAutomation guiAutomation, string text, int waitCount)
 {
     "Trying {0} times to find button '{1}'".info(waitCount, text);
     for (int i = 0; i < waitCount; i++)
     {
         guiAutomation.sleep(2000, true);                // wait 2 secs and try again
         try
         {
             var button = guiAutomation.button(text);
             if (button.notNull())
             {
                 return(button);
             }
         }
         catch
         {}
     }
     "Could not find button '{0}'".error(text);
     return(null);
 }
 public static bool hasButton(this API_GuiAutomation guiAutomation, string text) //search on the first window
 {
     return(guiAutomation.button(text).notNull());
 }