public GitHub_CustomO2 buildGui() { var topPanel = O2Gui.open <Panel>("GitHub", 1024, 600).insert_LogViewer(); return(buildGui(topPanel)); }
public static void launchControl() { O2Gui.open <CmdExeGui>("Cmd Exe GUI", 400, 300); }
public static API_GitHub_Objects show_GitHub_Browser(this API_GitHub_Objects gitHubObjects) { var topPanel = O2Gui.open <Panel>("Util - GitHub Browser", 1000, 400); return(gitHubObjects.login().add_GitHub_Browser(topPanel)); }
public static System.Windows.Forms.Control showInForm(this OpenXml_SpreadSheet spreadSheet) { var panel = O2Gui.open <Panel>("OpenXml viewer", 1000, 500); return(spreadSheet.showInControl(panel)); }
public static Control createExecutionGuiForFolder(string folder) { var topPanel = O2Gui.open <Panel>("Unit Test Execution for folder:{0}".format(folder), 700, 500); topPanel.insert_Below(100).add_LogViewer(); var files_TreeView = topPanel.insert_Left("Unit Test Files to compiled an execute").add_TreeView(); var unitTest = topPanel.add_Control <ascx_XRules_UnitTests>(); var textBox = topPanel.insert_Above <Panel>(25) .add_LabelAndTextAndButton("Unit Test file", "", "load", (file) => unitTest.loadFile(file)) .controls <TextBox>(); textBox.onDrop( (text) => { textBox.set_Text(text); unitTest.loadFile(text); }); Action <string> loadFileOrFolder = (fileOrFolder) => { if (fileOrFolder.fileExists()) { files_TreeView.add_Node(fileOrFolder.fileName(), fileOrFolder); } else { files_TreeView.add_Files(fileOrFolder, "*.cs", false); } }; Action <string> compileSelectedFile = (file) => { files_TreeView.backColor(Color.Azure); O2Thread.mtaThread( () => { var assembly = file.compile(); if (assembly.isNull()) { files_TreeView.backColor(Color.LightPink); } else { files_TreeView.backColor(Color.White); unitTest.loadFile(file); } }); }; files_TreeView.afterSelect <string>((file) => compileSelectedFile(file)); files_TreeView.onDoubleClick <string>((file) => compileSelectedFile(file)); files_TreeView.onDrop(loadFileOrFolder); files_TreeView.add_ContextMenu() .add_MenuItem("Edit File", () => files_TreeView.selected() .get_Tag() .str() .showInCodeEditor()); loadFileOrFolder(folder); return(topPanel); }
public static API_ConsoleOut show_ConsoleOut(this API_ConsoleOut apiConsoleOut) { var topPanel = O2Gui.open <Panel>("Console.Out", 700, 200); return(apiConsoleOut.show_ConsoleOut(topPanel)); }
public API_InjectMenu_AnotherProcess buildGui() { "******** API_InjectMenu_AnotherProcess ********:{0}".info(ProcessToInject); "Injecting O2 Menu into new Process :{0}".info(ProcessToInject); Action showProcessToHook = null; Action <int, IntPtr> handleCommand = (command, handle) => { if (handle == this.InjectedProcess.MainWindowHandle) { "Handing command: {0} from handle {1}".info(command, handle); CommandSelected(command, MenuCommands[command]); } }; Action <IntPtr, IntPtr, IntPtr, IntPtr> GetMsg_GetMsg = (handle, message, wParam, lParam) => { var messageId = message.ToInt32(); if (messageId == win32.WM_COMMAND) { var menuCommand = (wParam.ToInt32() & 0x0000FFFF); handleCommand(menuCommand, handle); //"(GetMsg_GetMsg) WM_COMMAND".info(); } }; //Create window to host messages received var popupWindow = O2Gui.open <Panel>("TM - Notepad++ Controller", 400, 400); //.popupWindow(); var genericWindow = new GenericWindow(); genericWindow.AssignHandle(popupWindow.Handle); var _GlobalHooks = new GlobalHooks(popupWindow.Handle); _GlobalHooks.GetMsg.GetMsg += new TransparencyMenu.GlobalHooks.WndProcEventHandler(GetMsg_GetMsg); // genericWindow.GetMsg_GetMsg); // genericWindow.WindowsMessage = _GlobalHooks.ProcessWindowMessage; //Build GUI popupWindow.add_Control <ascx_LogViewer>(); //insert_LogViewer(); Action <Process> addMenuItem = (process) => { var _Handle = process.MainWindowHandle; //Processes.getProcessCalled("notepad").MainWindowHandle; "Main Window HANDLE: {0}".info(_Handle); if (_Handle == IntPtr.Zero) { "Could not get main window handle from process.MainWindowHandle (stopping addMenuItem sequence)".error(); return; } //insert normal menu var windowMenuHandle = win32.GetMenu(_Handle); var numberOfMenuItems = win32.GetMenuItemCount(windowMenuHandle); var menuHandle = win32.CreateMenu(); foreach (var menuCommand in MenuCommands) { win32.InsertMenu(menuHandle, -1, win32.MF_BYPOSITION, menuCommand.Key, menuCommand.Value); } //win32.InsertMenu(menuHandle, -1, win32.MF_BYPOSITION, 02001, "Send Command 02004"); if (win32.InsertMenu(windowMenuHandle, numberOfMenuItems - 1, win32.MF_BYPOSITION | win32.MF_POPUP, menuHandle, this.MenuTitle)) { "O2's top level menu added".info(); } else { "Failed to add O2 menu".error(); } }; Action hookSelectedProcess = () => { GlobalHooks.HookIndex = InjectedProcess.Threads[0].Id; if (GlobalHooks.HookIndex == 1) { "GlobalHooks.HookIndex was set to 0, stop execution since global hooks are not supported".error(); return; } "Process Thread id: {0}".info(GlobalHooks.HookIndex); popupWindow.invokeOnThread(() => _GlobalHooks.GetMsg.Start()); }; Action unHookSelectedProcess = () => { "unHookSelectedProcess".info(); _GlobalHooks.GetMsg.Stop(); }; Action startProcessToInject = () => { InjectedProcess = Processes.startProcess(ProcessToInject); "waiting for inputIdle: {0}s".info(MaxWaitForWaitForInputIdle / 1000); if (InjectedProcess.WaitForInputIdle(MaxWaitForWaitForInputIdle).isFalse()) { "waited 4s for input idle so continuing...".debug(); } "after inputIdle".info(); if (InjectedProcess.MainWindowHandle == IntPtr.Zero) { for (var i = 0; i < 10; i++) { "waiting for process.MainWindowHandle".info(); InjectedProcess = Processes.getProcess(InjectedProcess.Id); //help to make sure the InjectedProcess.MainWindowHandle is set if (InjectedProcess.MainWindowHandle != IntPtr.Zero) { break; } this.sleep(5000); } } if (ExtraSleepAfterWaitForInputIdle > 0) { this.sleep(MaxWaitForWaitForInputIdle); } win32.SetWindowText(InjectedProcess.MainWindowHandle, InjectedProcess_WindowTitle); }; /*popupWindow.insert_Above(40,"Actions").add_Link("Add Menu item", 0,0,()=> addMenuItem(selectedProcess)) * / .append_Link("hook selected Process", * ()=> { * hookSelectedProcess(); * }) * .append_Link("Stop Hooks", ()=> unHookSelectedProcess()) * .append_Link("start notepad++", ()=> { * startNotepadPP(); * //currentFilter_TextBox.set_Text("notepad"); * //showProcessToHook(); * }); */ startProcessToInject(); addMenuItem(InjectedProcess); hookSelectedProcess(); O2Thread.mtaThread( () => { "Waiting hooked process to exit".info(); InjectedProcess.WaitForExit(); "selectedProcess.Exited".info(); popupWindow.parentForm().close(); }); return(this); }
public static WhoisControl whoIs() { return(O2Gui.open <Panel>("WhoIs Query", 500, 300) .add_WPF_Control <WhoisControl>()); }
public void openO2LogViewer() { O2Gui.open <ascx_LogViewer>(); }
public static void launchGui() { O2Gui.open <ascx_HtmlTagViewer>("Control - Html Tag Viewer", 1000, 400) .buildGui(true, true) .show(defaultPage.uri()); }
public bool install() { Func <string> getJdkDownloadUrl = () => { var topPanel = O2Gui.open <Panel>("Get JDK download link", 900, 600); var ie = topPanel.add_IE().silent(true); ie.open("http://www.oracle.com/technetwork/java/javase/downloads/index.html"); ie.button("Download JDK").click(); ie.selectLists()[0].options()[7].select(); ie.checkBox("dnld_license").check(); ie.button("Continue »").click(); string url = null; foreach (var link in ie.links()) { if (link.text().regEx("jdk.*.exe")) { return(link.url()); } } "couldn't find JDK download link".error(); topPanel.parentForm().close(); return(url); }; Func <string, string> downloadJdk = (downloadUrl) => { if (downloadUrl.valid()) { var targetDir = @"..\_O2Downloads".tempDir(false).fullPath(); var targetFile = targetDir.pathCombine(downloadUrl.uri().Segments.Last()); if (targetFile.fileExists()) { return(targetFile); } downloadUrl.download(targetFile); if (targetFile.fileExists()) { return(targetFile); } } return(null); }; var Install_Uri = getJdkDownloadUrl(); var localFile = downloadJdk(Install_Uri); "Installing {0}".info(ToolName); localFile.startProcess(); return(localFile.fileExists()); //return installFromExe_Web(); //For some weird reason the mouse doesn't work as soon as the installer has the focus // so for now we will have to do this manually /* * var guiAutomation = new API_GuiAutomation(); * var window = guiAutomation.desktopWindow("Java(TM) SE Development Kit 6 Update 24 - Setup"); * //window.bringToFront(); * //window.minimized(true); * var button = window.button("Next >").mouse(); * window.bringToFront(); * guiAutomation.mouse_Click (); */ }
public static void launchGui() { var folderView = O2Gui.open <ascx_FolderView>("Util - FolderView", 500, 400); folderView.loadFolder(PublicDI.config.LocalScriptsFolder); }
private static API_Blogger buildGui() { var panel = O2Gui.open <Panel>("O2 Platform Blogger API", 800, 600); panel.clear(); var hostPanel = panel.add_1x1("write", "live view", false); var newPostBody = hostPanel[0].add_Browser(); var optionsTab = newPostBody.insert_Above <TabControl>(100); var bloggerView = hostPanel[1].add_IE(); var bloggerApi = new API_Blogger(bloggerView); var newPostTitle = newPostBody.insert_Above <Panel>(20) .add_Label("New post Title:") .top(2) .append_TextBox(""); newPostTitle.align_Right(optionsTab); var postTitle = "title"; var postBody = "body"; newPostTitle.set_Text(postTitle); newPostBody.open(postBody.saveWithExtension(".html")); newPostBody.editMode(); newPostTitle.onTextChange((text) => postTitle = text); newPostBody.onTextChange((html) => postBody = html.htmlDocument().select("//body").innerHtml().str().trim()); var actionsTab = optionsTab.add_Tab("Actions"); var credentialsFile = actionsTab.add_Label("Use credentials from file:", 5, 0) .append_TextBox(defaultCredentialsFile); credentialsFile.align_Right(actionsTab); var credentialsType = actionsTab.add_Label("Credential Type: ", 30, 0) .append_TextBox(defaultCredentialsType); credentialsType.align_Right(actionsTab); var loginLink = actionsTab.add_Link("login", 55, 130, () => { if (credentialsFile.get_Text().fileExists()) { bloggerApi.login(credentialsFile.get_Text() .credential(credentialsType.get_Text())); } else { bloggerApi.login(); } }); loginLink.append_Link("logout", () => bloggerApi.logout()) .append_Link("dashboard", () => bloggerApi.dashboard()) .append_Link("new post page", () => bloggerApi.newPost()) .append_Link("preview new post", () => { bloggerApi.setNewPostContents(postTitle, postBody); bloggerApi.viewPreview(); }) .append_Link("submit new post", () => bloggerApi.publishPost()); bloggerApi.dashboard(); return(bloggerApi); }
public static T showAsForm <T>(this string title, int width, int height) where T : Control { return(O2Gui.open <T>(title, width, height) .add_H2Icon()); }
public void openO2LogViewer() { O2Gui.open <Panel>("O2 Log Viewer", 400, 300).add_LogViewer(); }
public static void startControl() { O2Gui.open <ascx_Create_Links_From_Clipboard>("Create Links from Clipboard", 400, 400); }
public static WatiN_IE window() { var control = O2Gui.open <Panel>("IE Window", 500, 400); return(window(control)); }
public static void launchGui() { O2Gui.open <ascx_MediaWiki_ConfigAndLogin>("MediaWiki Config and Login", 400, 400) .buildGui(new O2MediaWikiAPI(), (wikiApi) => {}); }
public static Panel view_AstNodes_SourceCode_Locations(this O2MappedAstData astData, List <AbstractNode> astNodes) { var topPanel = O2Gui.open <Panel>("INodes Source Code Viewer", 700, 400); return(astData.view_AstNodes_SourceCode_Locations(astNodes, topPanel)); }
public static ctrl_TableList show_In_ListView <T>(this IEnumerable <T> data, string title, int width, int height) { return(O2Gui.open <Panel>(title, width, height).add_TableList().show(data)); }
//note:the results of this are not consistent public static TreeView showInfo_ComObject(this object _rootObject) { var treeView = O2Gui.open <Panel>("showInfo_ComObject", 400, 400).add_TreeView(); var propertyGrid = treeView.insert_Below <Panel>().add_PropertyGrid(); Action <TreeNode, object> add_Object = (treeNode, _object) => { treeNode.clear(); //treeNode.add_Node(_object.str(), _object, true); WinForms_ExtensionMethods_TreeView.add_Node(treeNode, _object.str(), _object, true); }; Action <TreeNode, IEnumerable> add_Objects = (treeNode, items) => { treeNode.clear(); foreach (var item in items) { //treeNode.add_Node(item.str(), item, true); WinForms_ExtensionMethods_TreeView.add_Node(treeNode, item.str(), item, true); } }; treeView.beforeExpand <object>( (treeNode, _object) => { if (_object is String) { treeNode.add_Node(_object); } else { if (_object is IEnumerable) { add_Objects(treeNode, _object as IEnumerable); } else { foreach (PropertyDescriptor property in TypeDescriptor.GetProperties(_object)) { try { var value = property.GetValue(_object); treeNode.add_Node(property.Name.str(), value, true); } catch (Exception ex) { treeNode.add_Node(property.Name.str(), "O2 ERROR:".format(ex.Message), false); } } } } }); treeView.afterSelect <object>( (_object) => propertyGrid.show(_object)); if (_rootObject is IEnumerable) { add_Objects(treeView.rootNode(), _rootObject as IEnumerable); } else { add_Object(treeView.rootNode(), _rootObject); } return(treeView); }
public static O2BrowserIE openAsForm() { var panel = O2Gui.open <System.Windows.Forms.Panel>("Web Browser", 600, 500); return((O2BrowserIE)panel.add_WebBrowserWithLocationBar()); }
public static ascx_TableList show(this List <ManagementBaseObject> searchResults) { var panel = O2Gui.open <Panel>("WMI Query Results Viewer", 700, 400); return(searchResults.show_in_TableList(panel)); }
public void showLogViewer() { LogViewer = O2Gui.open <Panel>("MethodMappings Engine Logs", 400, 200).add_LogViewer(); }
public static Panel editLocalConfigFile(this string file) { var panel = O2Gui.open <Panel>("Editing local config file: {0}".format(file), 700, 300); return(file.editLocalConfigFile(panel)); }
public static ascx_IE_ScriptExecution launchGui() { return(O2Gui.open <ascx_IE_ScriptExecution>("IE Script Execution", 700, 600) .buildGui()); }
public static Panel showAsForm(this string title, int width, int height) { return(O2Gui.open <Panel>(title, width, height)); }
public static ascx_LogViewer showLogViewer() { return(O2Gui.open <ascx_LogViewer>()); }
public static void startControl() { O2Gui.open <ascx_Html_Editor>("Html Editor", 700, 500); }