public void launchGui() { var wpfRibbon = O2Gui.open <WPF_Ribbon>("Test - O2 WPF Ribbon", 600, 400); var tab1 = wpfRibbon.Ribbon.add_RibbonTab("tab1"); var group1 = tab1.add_RibbonGroup("group 1"); //wpfRibbon.buildGui(); }
public void showCodeStream() { CodeStream.show(CodeViewer.editor()); CodeStream.show(CodeStreamCodeViewer.editor()); CodeStream.show(CodeStreamTreeView); O2Thread.mtaThread( () => { if (ShowGraphInNewWindow) { if (JoinGraphData.isFalse()) { CodeStreamGraph = O2Gui.open <Panel>("O2 Ast Engine Graph", 400, 400).add_Graph(); } CodeStream.show(CodeStreamGraph); } else { if (JoinGraphData.isFalse()) { CodeStreamGraphPanel.clear(); CodeStreamGraph = CodeStreamGraphPanel.add_Graph(); } CodeStream.show(CodeStreamGraph); } CodeStreamGraphScript.InvocationParameters.add("graph", CodeStreamGraph); }); }
public static WPF_Ribbon create(string title, int width, int height) { var formTitle = "{0} (Custom O2)".format(title); var panel = O2Gui.open <WinForms.Panel>(formTitle, width, height); return(create(panel, title)); }
public void openSourceCodeEditor() { var sourceCodeEditor = O2Gui.open <Panel>("Source Code Editor", 600, 400).add_SourceCodeEditor(); var defaultSourceCode = CompileEngine.findScriptOnLocalScriptFolder("Hello_O2_World.cs").fileContents(); sourceCodeEditor.open(defaultSourceCode.saveWithExtension(".cs")); }
//launch stand alone version of DiagramDesigner public static void openDiagramDesignedInNewWindow() { var mainPanel = O2Gui.open <WinForms.Panel>("DiagramDesigner inside O2", 500, 400); var designerCanvas = mainPanel.add_DesignerCanvas(); designerCanvas.add_Label("This is new DesignerCanvas", 120, 100).fontSize(20); }
public static DotNet_AspNet_Compiler show_Help(this DotNet_AspNet_Compiler aspnetCompiler) { var panel = O2Gui.open <Panel>("Aspnet_Compiler Help", 400, 600); panel.add_TextArea().set_Text(aspnetCompiler.help()); return(aspnetCompiler); }
public static void lauchGui() { var pageEditor = O2Gui.open <ascx_MediaWiki_PageEditor_Simple>("MediaWiki Page Editor", 500, 500) .buildGui(new O2PlatformWikiAPI()); pageEditor.openPage("Main_Page"); }
public static string downloadFile(this Uri uri, string targetFile) { if (uri.isNull()) { return(null); } "Downloading file {0} to location:{1}".info(uri.str(), targetFile); if (targetFile.fileExists()) // don't download if file already exists { "File already existed, so skipping download".debug(); return(targetFile); } var sync = new System.Threading.AutoResetEvent(false); var downloadControl = O2Gui.open <DownloadFile>("Downloading: {0}".format(uri.str()), 455, 170); downloadControl.setAutoCloseOnDownload(true); downloadControl.setCallBackWhenCompleted((file) => downloadControl.parentForm().close()); downloadControl.onClosed(() => sync.Set()); downloadControl.setDownloadDetails(uri.str(), targetFile); downloadControl.downloadFile(); sync.WaitOne(); // wait for download complete or form to be closed targetFile.file_WaitFor_CanOpen(); if (targetFile.fileExists()) { return(targetFile); } return(null); }
public bool browseSvnArchive() { var svnBrowser = O2Gui.open <ascx_SvnBrowser>("Svn Browser"); //svnBrowser.openSvnUrl(svnServer); return(true); }
public static void testGui() { var wpfGui = O2Gui.open <WPF_GUI>("Test - O2 WPF Gui"); wpfGui.buildGui(); wpfGui.add_Section("Main", "This is the intro text. Put here an explanation of what this module is all about") .add_Label("this is a label 1") .add_Link_O2Script("Util - Simple Html Viewer", "Util - Simple Html Viewer.h2") .add_Link_O2Script("script that doesn't exist", "Aaaa.h2") .add_Link("test user control", () => { "before".info(); wpfGui.WinFormPanel.clear(); wpfGui.WinFormPanel.add_TreeView().backColor(Color.LightGray).add_Node("as"); "after".debug(); }) .add_Link_Web("BBC news", "http://news.bbc.co.uk") .add_Upgrade_Link("aaa", "http://code.google.com/p/o2platform/downloads/list") .add_Link("Source Code Viewer", (panel) => { panel.add_Control <ascx_SourceCodeViewer>(); }) .add_Link("Source Code Editor", (panel) => { panel.add_Control <SourceCodeEditor>(); }); wpfGui.add_Section("Section 1", "Text that describes Section 1") .add_Label("this is a label 1") .add_WrapPanel() .add_Link("label 2", () => {}) .add_Link("label 3", () => {}) .add_Link("label 4", () => {}); wpfGui.add_Section("Section 2"); wpfGui.add_Section("Section 3"); wpfGui.add_Section("Section 4"); wpfGui.add_Section("Section 5"); wpfGui.add_Section("Section 6"); wpfGui.add_Section("Section 7"); }
public static OpenXml_SpreadSheet show_SpreadSheet(this string fileToLoad) { var panel = O2Gui.open <Panel>("OpenXml viewer: {0}".format(fileToLoad.fileName()), 1000, 500); var spreadSheet = fileToLoad.open_SpreadSheet(); spreadSheet.showInControl(panel); return(spreadSheet); }
public static void launchGui() { var simpleSearch = O2Gui.open <ascx_SimpleFileSearch>("Util - Simple File Search", 500, 400); var localScriptsFolder = PublicDI.config.LocalScriptsFolder; var filesToShow = localScriptsFolder.files(true, "*.cs", "*.h2", "*.o2"); simpleSearch.loadFiles(localScriptsFolder, filesToShow); }
public static OpenXml_SpreadSheet show_SpreadSheetGUI() { var panel = O2Gui.open <Panel>("OpenXml viewer", 1000, 500); var spreadSheet = new OpenXml_SpreadSheet(); spreadSheet.showInControl(panel); return(spreadSheet); }
public static ascx_MovieEditor playLastVideoCreated(this ascx_MovieEditor movieEditor) { if (movieEditor.movieExists()) { O2Gui.open <Panel>("Video Player", 640, 480).add_VideoPlayer().play(movieEditor.AForge_Video.PathToAviVideo); } return(movieEditor); }
public static RibbonGroup add_RibbonButton_Web(this RibbonGroup ribbonGroup, string label, string url) { return(ribbonGroup.add_RibbonButton(label, () => { var panel = O2Gui.open <WinForms.Panel>("Web Browser: " + label, 600, 400); "Opening url: {0}".info(url); panel.add_Control <WinForms.WebBrowser>().open(url);; })); }
public string openAscxInNewWindow() { var monoDecompiler = O2Gui.showAsForm <ascx_MonoDecompiler>("Mono Decompiler"); //,400,400); //var monoDecompiler = (ascx_MonoDecompiler)O2AscxGUI.openAscx(typeof(ascx_MonoDecompiler), O2DockState.Float,"Mono Decompiler"); monoDecompiler.loadAssembly(testExe); monoDecompiler.tvDirectoriesAndFiles.selectNode(0); return("click on method to view it"); }
public static void showScriptEditor() { var scriptEditor = O2Gui.open <Panel>("AppScan Script editor", 600, 300).add_Script(false); scriptEditor.Code = "var appScan = \"\".lastFormLoaded();".line() + "appScan.set_Text(\"AppScan Standard - O2 Version\");".line() + "return appScan;"; scriptEditor.parentForm().top(600); }
public static T openAsForm <T>(this T control) where T : Control { var title = control.str(); var panel = O2Gui.open <Panel>(title, 300, 400); control.fill(); panel.add(control); return(control); }
public void openScript() { var script = O2Gui.open <System.Windows.Forms.Panel>("Script editor", 700, 300) .add_Script(false) .onCompileExecuteOnce(); script.InvocationParameters.add("simpleWorkerRequest", simpleWorkerRequest); script.Code = "hello"; }
public static void startControl() { processDetails = new List <ProcessDetail>(); processDetails.createTypeAndAddToList <ProcessDetail>("Reflector", @"C:\_DinisTest\tools\reflector\reflector.exe"); processDetails.createTypeAndAddToList <ProcessDetail>("Notepad", @"Notepad.exe", "test"); processDetails.createTypeAndAddToList <ProcessDetail>("Cmd", @"Cmd.exe"); O2Gui.open <ascx_Start_Tools>("Start Tools v1.1", 400, 200); }
public static Control showAscxInForm(Type controlType, string formTitle, int width = -1, int height = -1, bool startHidden = false) { var controlCreation = new AutoResetEvent(false); Control control = null; O2Thread.staThread( ()=> { O2Gui o2Gui = null; try { control = (Control)PublicDI.reflection.createObjectUsingDefaultConstructor(controlType); if (control != null) { control.Dock = DockStyle.Fill; o2Gui = new O2Gui(width, height) ; // I might need to adjust these width, height so that the control is the one with this size (and not the hosting form) o2Gui.Text = formTitle; if (width > -1) control.Width = width; else o2Gui.Width = control.Width; // if it is not defined resize the form to fit the control if (height > -1) control.Height = height; else o2Gui.Height = control.Height; // if it is not defined resize the form to fit the control o2Gui.clientSize(control.Width, o2Gui.Height); // reset the form size to the control's size o2Gui.Controls.Add(control); o2Gui.Load += (sender, e) => controlCreation.Set(); if (startHidden) // very useful from UnitTests and cases where more should be added to the UI before showing it { o2Gui.Opacity = 0; o2Gui.ShowInTaskbar = false; } o2Gui.showDialog(false); } else controlCreation.Set(); } catch (Exception ex) { "in showAscxInForm: {0}".format(ex).error(); controlCreation.Set(); } finally { if (o2Gui != null) o2Gui.Dispose(); } }); var maxTimeOut = System.Diagnostics.Debugger.IsAttached ? -1 : 20000; if (controlCreation.WaitOne(maxTimeOut).failed()) "[WinForms] Something went wrong with the creation of the {0} control with title '{1}' since it took more than 20s to start".error(controlType, formTitle); return control; }
//public string cmdDefaultDebuggedProcess = "calc.exe"; public static void launchO2UnderDebugger() { //var pathToO2Exe = PublicDI.config.CurrentExecutableDirectory.pathCombine(PublicDI.config.CurrentExecutableFileName); var pathToO2Exe = PublicDI.config.CurrentExecutableDirectory.pathCombine("DiagramDesigner.exe"); "launching O2 under debugger: {0}".info(pathToO2Exe); O2Gui.open <SonOfStrikeGui>("SunOfStrike API", 600, 400) .launch(pathToO2Exe);; //new SonOfStrikeGui().launch(pathToO2Exe); }
public void launchGui() { var astData = new O2MappedAstData(); astData.loadFiles(@"C:\O2\DemoData\HacmeBank_v2.0 (Dinis version - 7 Dec 08)\HacmeBank_v2_WS\classes".files()); var control = O2Gui.open <Panel>("test ascx_WriteRule", 700, 500); var writeRule = control.add_Control <ascx_WriteRule>(); writeRule.buildGui(astData); }
public void launchGui() { var astData = new O2MappedAstData(); //astData.loadFile("HacmeBank_v2_Website.ascx.PostMessageForm.btnPostMessage_Click.cs".local()); var control = O2Gui.open <Panel>("AST Search (.NET Static Analysis)", 1000, 600); var searchAST = control.add_Control <ascx_SearchAST>(); searchAST.buildGui(astData); }
public static ascx_Panel_With_Inspector runControl(string file) { var currentProcess = Processes.getCurrentProcess(); var panelWithInspector = O2Gui.load <ascx_Panel_With_Inspector>("C# REPL Editor ({0})".format(clr.details())); //and name: {1})".format(clr.details(), currentProcess.ProcessName)); if (file.valid()) { panelWithInspector.inspector.openFile(file); } return(panelWithInspector); }
//public Dictionary<IMethod, string> MethodStreams { get; set; } public void start() { var astEngine = O2Gui.open <O2_DotNet_Ast_Engine>("O2 .NET Ast Engine", 800, 600); astEngine.buildGui(); //astEngine.step_LoadArtifacts(); //astEngine.AstData.O2AstResolver.addReference("System.Data"); //astEngine.loadSourceFiles(@"C:\O2\DemoData\HacmeBank_v2.0 (Dinis version - 7 Dec 08)\HacmeBank_v2_WS".files("*.cs",true)); //astEngine.step_WhoCallsWho(); }
public void launchGui() { var astData = new O2MappedAstData(); astData.loadFile("HacmeBank_v2_Website.ascx.PostMessageForm.btnPostMessage_Click.cs".local()); var control = O2Gui.open <Panel>("test ascx_ViewAST", 1000, 600); var viewAST = control.add_Control <ascx_ViewAST>(); viewAST.buildGui(astData); }
public static ICredential ask() { var loginDetailsGui = O2Gui.open <ascx_AskUserForLoginDetails>("Enter Login Details", 250, 115); loginDetailsGui.buildGui(); var credential = loginDetailsGui.getAnswer(); loginDetailsGui.close(); return(credential); }
private static KReflection reflection = new KReflection(); //PublicDI.reflection; public static void openAscxInNewWindow() { var executeWizards = O2Gui.showAsForm <ascx_AssemblyAttributes>("View Assembly Attributes", 400, 400); var targetFile = PublicDI.config.CurrentExecutableDirectory.pathCombine("FluentSharp.CoreLib.dll"); if (targetFile.fileExists()) { log.debug("File exists: {0}", targetFile); executeWizards.loadAssembly(targetFile); } }
public static ascx_IE_ScriptExecution launchGui_NoCodeComplete() { var host = O2Gui.open <Panel>("IE Script Execution (no code complete)", 600, 400); return((ascx_IE_ScriptExecution)host.invokeOnThread( () => { var ieExecution = new ascx_IE_ScriptExecution(false).fill(); ieExecution.buildGui(); host.add_Control(ieExecution); return ieExecution; })); }
public static ascx_Simple_Script_Editor startControl() { var control = O2Gui.load <ascx_Simple_Script_Editor>("O2 Simple Script Editor", 700, 300); control.invokeOnThread(() => { control.InvocationParameters.Add("testString", "Hello World"); control.InvocationParameters.Add("testNumber", 42); control.commandsToExecute.set_Text(control.defaultCode); }); return(control); }
public static Control showAscxInForm(Type controlType, string formTitle, int width, int height) { var controlCreation = new AutoResetEvent(false); Control control = null; O2Thread.staThread( ()=> { O2Gui o2Gui = null; try { control = (Control)PublicDI.reflection.createObjectUsingDefaultConstructor(controlType); if (control != null) { control.Dock = DockStyle.Fill; o2Gui = new O2Gui(width, height, false) // I might need to adjust these width, height so that the control is the one with this size (and not the hosting form) { Text = formTitle }; if (width > -1) control.Width = width; else o2Gui.Width = control.Width + 10; // if it is not defined resize the form to fit the control if (height > -1) control.Height = height; else o2Gui.Height = control.Height + 20; // if it is not defined resize the form to fit the control // note: need to double check if the correct values to add to the form (above) are 10 and 20 o2Gui.Controls.Add(control); o2Gui.Load += (sender, e) => controlCreation.Set(); //o2Gui.showDialog(false); o2Gui.showDialog(false); } else controlCreation.Set(); } catch (Exception ex) { "in showAscxInForm: {0}".format(ex).error(); controlCreation.Set(); } finally { if (o2Gui != null) o2Gui.Dispose(); } }); controlCreation.WaitOne(); return control; }