Ejemplo n.º 1
0
        public static API_GitHub gitClone(this API_GitHub gitHub, string url, string targetDir, string privateKeyFile)
        {
            if (targetDir.inValid())
            {
                targetDir = "".tempDir();
            }
            var guiAutomation = new API_GuiAutomation();

            if (guiAutomation.desktopWindow("Git clone").isNull())              // see if there is already an 'Git clone' window
            {
                //Create a form window with a webbrowser that will open a local folder
                var windowName = "This is Git Clone target folder  (id:{0})".format(3.randomNumbers());
                var topPanel   = O2Gui.open <Panel>(windowName, 600, 200);
                var webBrowser = topPanel.add_WebBrowser_Control();
                webBrowser.open(targetDir);
                webBrowser.mouse_MoveTo_WinForm();

                // get the form and right click on it
                var window = guiAutomation.desktopWindow(windowName);
                guiAutomation.mouse().click().rightClick();

                // get the context menu and click on the 'Git Clone...' menu button
                var contextMenu = guiAutomation.getContextMenu();
                contextMenu.menu("Git Clone...").mouse().click();
            }
            // get the Git Clone window
            var gitClone = guiAutomation.desktopWindow("Git clone", 10);

            gitClone.bringToFront();
            // get a reference to the textboxes we will need to populate
            var url_TextBox       = gitClone.textBox("Url: ");
            var directory_TextBox = gitClone.textBox("Directory:");
            var puttyKey_TextBox  = gitClone.textBoxes().id(1571);

            if (url.valid())
            {
                url_TextBox.set_Text(url);
            }
            if (privateKeyFile.valid() && privateKeyFile.fileExists())
            {
                puttyKey_TextBox.set_Text(privateKeyFile);
            }
            //directory_TextBox.set_Text(targetDir);   // no need to do this since it is added when we use the context menu

            // Click button
            gitClone.button("OK").mouse().click();

            return(gitHub);
        }
 public static PopUpMenu getContextMenu(this API_GuiAutomation guiAutomation)
 {
     try
     {
         var emptyWindow = guiAutomation.desktopWindow("");
         return(emptyWindow.Popup);
     }
     catch
     {
     }
     return(null);
 }
 public static Window desktopWindow(this API_GuiAutomation guiAutomation, string name, int numberOfTries)
 {
     for (int i = 0; i < numberOfTries; i++)
     {
         var window = guiAutomation.desktopWindow(name);
         if (window.notNull())
         {
             "after {0} tries, found window with title: {1}".info(i, name);
             return(window);
         }
         guiAutomation.sleep(1000, false);
     }
     "after {0} tries, cound not find window with title: {1}".info(numberOfTries, name);
     return(null);
 }
Ejemplo n.º 4
0
        public override bool unInstall()
        {
            if (this.isInstalled() && this.Uninstall_Exe.fileExists())
            {
                "[API_Fiddler] Starting Fiddler UnInstall process".info();
                var guiAutomation = new API_GuiAutomation();
                guiAutomation.launch(this.Uninstall_Exe);

                var processID = guiAutomation.TargetProcess.Id;
                //var finder = new AutomationElementFinder(AutomationElement.RootElement);
                var uninstallWindow = guiAutomation.desktopWindow("Fiddler2 Uninstall: Confirmation");
                uninstallWindow.button("Uninstall").click();
                uninstallWindow.button("Close").click();
                "[API_Fiddler] Fiddler UnInstall complete".info();
                if (this.isInstalled().isFalse())
                {
                    return(true);
                }
                "[API_Fiddler] There was an error in the UnInstall process (since fiddler is still installed)".info();
                return(false);
            }
            "[API_Fiddler] in unInstall, Fiddler is not installed, so nothing to do".debug();
            return(false);
        }