public RadioButton(int x, int y, string id, string radioGroup, Window.Window parentWindow) : base(x, y, 3, 1, parentWindow, id) { RadioGroup = radioGroup; BackColor = parentWindow.BackColor; Selectable = true; }
public TextBlock(string text, int x, int y, int width, int height, Window.Window parentWindow, string iD = null) : base(x, y, width, height, parentWindow, iD) { Selectable = true; BackColor = parentWindow.BackColor; Text = text; }
public CheckBox(int x, int y, string title, Window.Window parentWindow, string id = null) : base(x, y, 3 + (title ?? string.Empty).Length, 1, parentWindow, id) { Title = title ?? string.Empty; BackColor = parentWindow.BackColor; Selectable = true; }
public Label(Func <string> getter, int x, int y, Window.Window parentWindow, string id = null) : base(x, y, (getter ?? (() => string.Empty)).Invoke().Length, 1, parentWindow, id) { TextGetter = getter ?? (() => string.Empty); BackColor = parentWindow.BackColor; Selectable = false; }
public void Test4() { Jint.Engine engine = new Jint.Engine(); IDocument htmlDocument = new Document(); htmlDocument.HtmlDocument = new AngleSharp.Html.Parser.HtmlParser().ParseDocument(htmlContent); Window.Window window1 = new Window.Window(engine); window1.document = htmlDocument.HtmlDocument; window1.InitializeEngine(); var jquery = System.IO.File.ReadAllText(@"../../../../BrowseSharpPlayground/jquery.js"); //engine.Execute("window.document.readyState = \"Loading\";"); engine.Execute(jquery); engine.Execute("var $ = window.jQuery;"); var script = "$(document).ready(function() {$('#content').text('hello there it worked');})"; //var cleanedScript = new Regex(); Regex regex = new Regex(@"(\$\([^document]*document[^)]*\)[^.]*.ready[^(]*\([^function]*function[^(]*\([^)]*\)[^{]*{)([^a|a]*)(}\))"); engine.Execute(regex.Match(script).Groups[2].Value); //engine.Execute("window.document.readyState = 'complete'"); //engine.Execute("$(document).trigger('ready',window.document)"); //engine.Execute("$(document).trigger('ready')"); Assert.AreEqual("hello there it worked", window1.document.GetElementById("content").TextContent); }
public Label(string text, int x, int y, Window.Window parentWindow, string id = null) : base(x, y, text.Length, 1, parentWindow, id) { TextGetter = () => text; BackColor = parentWindow.BackColor; Selectable = false; }
public TextBox(int x, int y, string text, string id, Window.Window parentWindow, int length = 20) : base(x, y, length, 1, parentWindow, id) { Text = text; CursorPostion = text.Length; Selectable = true; BackColor = Terminal.LIGHT_CYAN; }
public MenuButton(int x, int y, string text, Window.Window parentWindow, string id = null) : base(x, y, text, parentWindow, id) { BackColor = Terminal.DARK_GRAY; TextColor = Terminal.WHITE; SelectedBackColor = Terminal.GRAY; SelectedTextColor = Terminal.WHITE; }
public Input(int xPosition, int yPosition, int width, int height, Window.Window parentWindow, string id = null) { ParentWindow = parentWindow; Id = id ?? Guid.NewGuid().ToString(); PositionX = xPosition; PositionY = yPosition; _height = height; _width = width; }
public async Task jQueryClickTest() { string script = "var numClicks = 0;\n" + "$('#btn').click(function() {\n" + "$('#message').text(\"hello there you clicked the button \" + numClicks + \" times\");\n" + "});"; string html = @"<!DOCTYPE html>\n<html> <head> </head> <body> <div id='message'>empty</div> <input type='button' id='btn'>Click me please</input> </body> </html>"; Jint.Engine engine = new Jint.Engine(); IDocument document = new Document(); var parser = new AngleSharp.Html.Parser.HtmlParser(new AngleSharp.Html.Parser.HtmlParserOptions() { IsScripting = true }); bool waitForScripts = true; //parser.AddEventListener(AngleSharp.Dom.EventNames.Parsing, (target,ev) => { document.HtmlDocument = (IHtmlDocument)target; while (waitForScripts) { Thread.Sleep(250); } }); //CancellationToken parserCanellationToken = new CancellationToken(); /*Task<IHtmlDocument> parseTask = Task.Run(() => { return parser.ParseDocumentAsync(html, parserCanellationToken); }); * * Thread.Sleep(500); * while(document.HtmlDocument == null) * { * * }*/ Window.Window window1 = new Window.Window(engine); window1.document = parser.ParseDocument(html); window1.InitializeEngine(); var jquery = System.IO.File.ReadAllText(@"../../../../BrowseSharpPlayground/jquery.js"); //engine.Execute("window.document.readyState = \"Loading\";"); engine.Execute(jquery); engine.Execute("var $ = window.jQuery;"); engine.Execute(script); waitForScripts = false;; CheckMessage(engine, document, "empty"); engine.Execute("$('#btn').trigger('click');"); CheckMessage(engine, document, "hello there you clicked the button 1 times"); }
public Button(int x, int y, string text, Window.Window parentWindow, string id = null) : base(x, y, text.Length + 2, 1, parentWindow, id) { Text = text; BackColor = parentWindow.BackColor == Terminal.RED ? Terminal.LIGHT_RED : parentWindow.BackColor == Terminal.GREEN ? Terminal.LIGHT_GREEN : parentWindow.BackColor == Terminal.BLUE ? Terminal.LIGHT_BLUE : Terminal.DARK_GRAY; Selectable = true; }
public void Test3() { Jint.Engine engine = new Jint.Engine(); IDocument htmlDocument = new Document(); htmlDocument.HtmlDocument = new AngleSharp.Html.Parser.HtmlParser().ParseDocument(htmlContent); Window.Window window1 = new Window.Window(engine); window1.document = htmlDocument.HtmlDocument; window1.InitializeEngine(); var jquery = System.IO.File.ReadAllText(@"../../../../BrowseSharpPlayground/jquery.js"); engine.Execute(jquery); engine.Execute("var $ = window.jQuery;"); engine.Execute("$('#content').text('hello there it worked');"); //engine.Execute("$(document).trigger('ready')"); Assert.AreEqual("hello there it worked", window1.document.GetElementById("content").TextContent); }
public FileBrowser(int x, int y, int width, int height, StorageFolder path, Window.Window parentWindow, bool includeFiles = false, string filterByExtension = null, string id = null, bool traverseDirectories = true) : base(x, y, width, height, parentWindow, id) { _traverseDirectories = traverseDirectories; CurrentPath = path; CurrentlySelectedFile = string.Empty; BackColor = Terminal.LIGHT_CYAN; IncludeFiles = includeFiles; FilterByExtension = filterByExtension ?? ".basic"; Drives = BasicOne.KnownStorageFolders; GetFileNames(); if (FileNames.Any()) { CurrentlySelectedFile = FileNames[0]; } Selectable = true; }
public async Task vanillaJsClickTest() { string script = "var numClicks = 0; function onClickBtn(){numClicks += 1; document.getElementById('message').textContent = \"hello there you clicked the button \" + numClicks + \" times\";}; "; string html = @" <!DOCTYPE html> <html> <head> </head> <body> <div id='message'>empty</div> <button id='btn' onclick='onClickBtn();'>Click me please</button> </body> </html>"; //var context = BrowsingContext.New(new Configuration.Default.WithJavaScript()); Jint.Engine engine = new Jint.Engine(); IDocument htmlDocument = new Document(); Window.Window window1 = new Window.Window(engine); window1.document = htmlDocument.HtmlDocument; window1.InitializeEngine(); var jquery = System.IO.File.ReadAllText(@"../../../../BrowseSharpPlayground/jquery.js"); //engine.Execute("window.document.readyState = \"Loading\";"); engine.Execute(jquery); engine.Execute("var $ = window.jQuery;"); engine.Execute(script); CheckMessage(engine, htmlDocument, "empty"); ((AngleSharp.Html.Dom.IHtmlElement)window1.document.GetElementById("btn")).DoClick(); CheckMessage(engine, htmlDocument, "hello there you clicked the button 1 times"); }
/// <summary> /// Updates a texture from the contents of a window. /// </summary> /// <param name="window">Window to copy to the texture.</param> /// <param name="x">X offset in the texture where to copy the source pixels.</param> /// <param name="y">Y offset in the texture where to copy the source pixels.</param> public void Update(Window.Window window, uint x = 0, uint y = 0) { sfTexture_updateFromWindow(CPointer, window.CPointer, x, y); }
public ProgressBar(int percentageComplete, int x, int y, int height, int width, string id, Window.Window parentWindow) : base(x, y, width, height, parentWindow, id) { Selectable = false; PercentageComplete = percentageComplete; }
/// <summary> /// Visualises the specified mesh on the window. /// </summary> /// <param name="mesh"></param> private static void RunWindow(IMesh mesh) { using (Window.Window window = new Window.Window(800, 600, A_WindowName, mesh)) { window.Run(60.0); } }
public void TestMethod1() { BOM.Window.Window window = new Window.Window(); }
public void Test2() { Window.Window window = new Window.Window(); }