public BodyBasedPropagatesToAppBatTitleFormCanvasStrategy(IHtmlFormCanvas createFor) { _for = createFor; _el = new HTMLDivElement(); _el.SetAttribute(Magics.AttrDataFormId, createFor.FormId); _el.SetValuelessAttribute(Magics.AttrDataFormTitle); }
public static void OnLoad() { #if DEBUG Document.GetElementById <HTMLDivElement>("DebugFlag").Hidden = false; #endif topError = Document.GetElementById <HTMLDivElement>("D_JsWarn"); topError.Hidden = true; Document.GetElementById <HTMLParagraphElement>("P_Version").TextContent = "Switch theme injector online - Version : " + AppVersion + " - Core version : " + SwitchThemesCommon.CoreVer; string useragent = Window.Navigator.UserAgent.ToLower(); if (useragent.Contains("msie") || useragent.Contains("trident")) { Document.GetElementById <HTMLDivElement>("D_IeWarn").Hidden = false; } loader = Document.GetElementById <HTMLDivElement>("loaderDiv"); LoaderText = Document.GetElementById <HTMLParagraphElement>("LoadingText"); lblDetected = Document.GetElementById <HTMLParagraphElement>("P_DetectedSZS"); lblDDSPath = Document.GetElementById <HTMLParagraphElement>("P_DDSPath"); lblDDSPath_NX = Document.GetElementById <HTMLParagraphElement>("P_DDSPath2"); LayoutsComboBox = Document.GetElementById <HTMLSelectElement>("LayoutsBox"); LayoutPrevDiv = Document.GetElementById <HTMLDivElement>("PreviewDiv"); LayoutPrevImg = Document.GetElementById <HTMLImageElement>("PreviewImg"); HomePartBox_NX = Document.GetElementById <HTMLSelectElement>("HomePartBox"); LayoutsComboBox_NX = Document.GetElementById <HTMLSelectElement>("LayoutsBox2"); LayoutPrevDiv_NX = Document.GetElementById <HTMLDivElement>("PreviewDiv2"); LayoutPrevImg_NX = Document.GetElementById <HTMLImageElement>("PreviewImg2"); Document.GetElementById <HTMLParagraphElement>("P_PatchList").InnerHTML = SwitchThemesCommon.GeneratePatchListString(DefaultTemplates.templates).Replace("\r\n", "<br />"); LoadCustomLayouts(); }
static void OnLoaded() { Document.GetElementById <HTMLParagraphElement>("pVersion").TextContent = "Ver " + AppVersion.ToString("N1"); Document.GetElementById <HTMLDivElement>("javascriptWarn").Hidden = true; ImagesDiv = Document.GetElementById <HTMLDivElement>("PlaceImages"); ColorsDiv = Document.GetElementById <HTMLDivElement>("PlaceColorEditors"); loader = Document.GetElementById <HTMLDivElement>("loaderDiv"); LoaderText = Document.GetElementById <HTMLParagraphElement>("LoadingText"); TopFrameType = Document.GetElementById <HTMLSelectElement>("Top-screen-TYP"); BotFrameType = Document.GetElementById <HTMLSelectElement>("Bottom-screen-TYP"); TopFrameType.OnChange += ListBoxChanged; BotFrameType.OnChange += ListBoxChanged; Window.OnResize += OnResized; string useragent = Window.Navigator.UserAgent.ToLower(); if (useragent.Contains("edge")) { Document.GetElementById <HTMLDivElement>("EdgeWarn").Hidden = false; } else if (useragent.Contains("msie") || useragent.Contains("trident")) { Document.GetElementById <HTMLDivElement>("interwebExplorerWarn").Hidden = false; } }
public EditableLabel(string text = string.Empty) { _labelText = Span(_("tss-editablelabel-textspan", text: text, title: "Click to edit")); _editIcon = I(_("tss-editablelabel-edit-icon las la-edit")); _labelView = Div(_("tss-editablelabel-displaybox"), _labelText, _editIcon); InnerElement = TextBox(_("tss-editablelabel-textbox", type: "text")); _cancelEditIcon = Div(_("tss-editablelabel-cancel-icon", title: "Cancel edit"), I(_("las la-times"))); _editView = Div(_("tss-editablelabel-editbox"), InnerElement, _cancelEditIcon); _container = Div(_("tss-editablelabel"), _labelView, _editView); AttachChange(); AttachInput(); AttachFocus(); AttachBlur(); AttachKeys(); _labelView.addEventListener("click", BeginEditing); _cancelEditIcon.addEventListener("click", CancelEditing); OnKeyUp((_, e) => { if (e.key == "Enter") { BeginSaveEditing(); } else if (e.key == "Escape") { CancelEditing(); } }); OnBlur((_, __) => BeginSaveEditing()); }
public static void StartGame() { debug = Document.GetElementById <HTMLDivElement>("debug"); // Set up canvas rendering. screen = Document.GetElementById <HTMLCanvasElement>("screen"); screenContext = screen.GetContext(CanvasTypes.CanvasContext2DType.CanvasRenderingContext2D); lightPixel = screenContext.CreateImageData(1, 1); lightPixel.Data[1] = 0x64; // Set green part (#006400) lightPixel.Data[3] = 255; // Alpha // Set up touch events for canvas so we can play on mobile. screen.OnTouchStart += SetTouchDown; screen.OnTouchEnd += SetTouchUp; // Set up audio. // http://stackoverflow.com/a/23395136/25124 beep = new HTMLAudioElement("data:audio/wav;base64,//uQRAAAAWMSLwUIYAAsYkXgoQwAEaYLWfkWgAI0wWs/ItAAAGDgYtAgAyN+QWaAAihwMWm4G8QQRDiMcCBcH3Cc+CDv/7xA4Tvh9Rz/y8QADBwMWgQAZG/ILNAARQ4GLTcDeIIIhxGOBAuD7hOfBB3/94gcJ3w+o5/5eIAIAAAVwWgQAVQ2ORaIQwEMAJiDg95G4nQL7mQVWI6GwRcfsZAcsKkJvxgxEjzFUgfHoSQ9Qq7KNwqHwuB13MA4a1q/DmBrHgPcmjiGoh//EwC5nGPEmS4RcfkVKOhJf+WOgoxJclFz3kgn//dBA+ya1GhurNn8zb//9NNutNuhz31f////9vt///z+IdAEAAAK4LQIAKobHItEIYCGAExBwe8jcToF9zIKrEdDYIuP2MgOWFSE34wYiR5iqQPj0JIeoVdlG4VD4XA67mAcNa1fhzA1jwHuTRxDUQ//iYBczjHiTJcIuPyKlHQkv/LHQUYkuSi57yQT//uggfZNajQ3Vmz+Zt//+mm3Wm3Q576v////+32///5/EOgAAADVghQAAAAA//uQZAUAB1WI0PZugAAAAAoQwAAAEk3nRd2qAAAAACiDgAAAAAAABCqEEQRLCgwpBGMlJkIz8jKhGvj4k6jzRnqasNKIeoh5gI7BJaC1A1AoNBjJgbyApVS4IDlZgDU5WUAxEKDNmmALHzZp0Fkz1FMTmGFl1FMEyodIavcCAUHDWrKAIA4aa2oCgILEBupZgHvAhEBcZ6joQBxS76AgccrFlczBvKLC0QI2cBoCFvfTDAo7eoOQInqDPBtvrDEZBNYN5xwNwxQRfw8ZQ5wQVLvO8OYU+mHvFLlDh05Mdg7BT6YrRPpCBznMB2r//xKJjyyOh+cImr2/4doscwD6neZjuZR4AgAABYAAAABy1xcdQtx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camcJnMW26MRPgUw6j+LkhyHGVGYjSUUKNpuJUQoOIAyDvEyG8S5yfK6dhZc0Tx1KI/gviKL6qvvFs1+bWtaz58uUNnryq6kt5RzOCkPWlVqVX2a/EEBUdU1KrXLf40GoiiFXK///qpoiDXrOgqDR38JB0bw7SoL+ZB9o1RCkQjQ2CBYZKd/+VJxZRRZlqSkKiws0WFxUyCwsKiMy7hUVFhIaCrNQsKkTIsLivwKKigsj8XYlwt/WKi2N4d//uQRCSAAjURNIHpMZBGYiaQPSYyAAABLAAAAAAAACWAAAAApUF/Mg+0aohSIRobBAsMlO//Kk4soosy1JSFRYWaLC4qZBYWFRGZdwqKiwkNBVmoWFSJkWFxX4FFRQWR+LsS4W/rFRb/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////VEFHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAU291bmRib3kuZGUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMjAwNGh0dHA6Ly93d3cuc291bmRib3kuZGUAAAAAAAAAACU="); // Create the interpreter. chip8 = new Chip8(Draw, Beep); // Pass keypresses over to the interpreter. Document.OnKeyDown += SetKeyDown; Document.OnKeyUp += SetKeyUp; // Kick off async loading of ROM. BeginLoadRom(ROM); }
public Dropdown(HTMLSpanElement noItemsSpan = null) { _noItemsSpan = noItemsSpan ?? Span(_(text: "There are no options available")); InnerElement = Div(_("tss-dropdown"), _noItemsSpan); _errorSpan = Span(_("tss-dropdown-error")); _container = Div(_("tss-dropdown-container"), InnerElement, _errorSpan); _childContainer = Div(_()); InnerElement.onclick = (e) => { StopEvent(e); if (!IsVisible && IsEnabled) { Show(); } }; _container.onclick = (e) => { StopEvent(e); if (!IsVisible && IsEnabled) { Show(); } }; _callSelectOnChangingItemSelections = true; _selectedChildren = new ObservableList <Item>(); _latestRequestID = 0; }
public static void Main() { var canvasSize = new IntSize(400, 800); var div = new HTMLDivElement(); div.style.width = $"{canvasSize.Width}px"; div.style.height = $"{canvasSize.Height}px"; document.body.appendChild(div); var button = new HTMLButtonElement(); button.innerHTML = "Click on game area to start it!"; button.style.width = "100%"; button.style.height = "100%"; button.style.backgroundColor = "#6495ED"; button.style.color = "#ffffff"; button.style.fontSize = "20px"; div.appendChild(button); button.onclick = (ev) => { div.removeChild(button); var canvas = new HTMLCanvasElement(); canvas.style.width = "100%"; canvas.style.height = "100%"; canvas.id = "monogamecanvas"; div.appendChild(canvas); game = new TheGame(canvasSize, Platform.Desktop); game.Run(); }; }
static void Main() { var rootDiv = new HTMLDivElement(); HTMLElement.AppendChildToRoot(rootDiv); var div = new HTMLDivElement(); rootDiv.AppendChild(div); div.InnerText = "Hello world!"; var button1 = new HTMLButtonElement(); rootDiv.AppendChild(button1); button1.InnerText = "Click me!"; button1.Click += () => { div.InnerText = "Hello world from button!"; }; var button2 = new HTMLButtonElement(); rootDiv.AppendChild(button2); button2.InnerText = "Load data!"; button2.Click += async() => { using (var httpClient = new HttpClient()) { var json = await httpClient.GetStringAsync("weather.json"); var weatherForecastArray = JsonUtil.Deserialize <WeatherForecast[]>(json); div.InnerText = weatherForecastArray[0].ToString(); } }; }
private void Update <T>(ObservableArrayArgs <T> arg) { var numOfElement = 0; Context = arg.Element; switch (arg.Action) { case ObservableAction.Push: arg.Renderer.Call(arg.Element, arg.Item, arg.Index); break; case ObservableAction.Add: if (arg.Index == arg.Array.Length - 1) { arg.Renderer.Call(arg.Element, arg.Item, arg.Index); return; } var div = new HTMLDivElement(); Context = div; arg.Renderer.Call(div, arg.Item, arg.Index); AppendChildList(arg.Element, div, arg.Index); break; case ObservableAction.Remove: numOfElement = arg.Element.Children.Length / (arg.Array.Length + 1); RemoveChildList(arg.Element, arg.Index, numOfElement); break; case ObservableAction.Move: numOfElement = arg.Element.Children.Length / arg.Array.Length; var newIndex = arg.Index; var oldIndex = Array.IndexOf(arg.Array, arg.Item); if (newIndex == oldIndex) { return; } var firstOldElementIndex = oldIndex * numOfElement; var nodeToInsert = oldIndex < newIndex ? arg.Element.Children[(newIndex + 1) * numOfElement] : arg.Element.Children[newIndex * numOfElement]; for (var j = 0; j < numOfElement; j++) { arg.Element.InsertBefore(arg.Element.Children[firstOldElementIndex], nodeToInsert); if (oldIndex > newIndex) { firstOldElementIndex++; } } break; case ObservableAction.Render: ClearContextContent(); var length = arg.Array.Length; var i = -1; while (++i < length) { Context = arg.Element; arg.Renderer.Call(arg.Element, arg.Array[i], i); } break; } }
public HTMLBackground(string url, double opacity, int delay = 3) { background = new HTMLDivElement(); background.Style.ZIndex = "-1"; background.Style.Overflow = Overflow.Hidden; background.Style.Visibility = Visibility.Visible; background.Style.Position = Position.Fixed; background.Style.Top = "0px"; background.Style.Left = "0px"; background.Style.Width = string.Format("{0}px", Window.InnerWidth); background.Style.Height = string.Format("{0}px", Window.InnerHeight); background.Style.Opacity = string.Format("{0}", 0); Document.Body.AppendChild(background); image = new HTMLImageElement(); image.Src = url; image.Style.Position = Position.Relative; background.AppendChild(image); image.OnLoad += delegate { sizeElements(); background.Style.TransitionDuration = string.Format("{0}s", delay); background.Style.Opacity = string.Format("{0}", opacity); }; Window.OnResize += delegate { background.Style.TransitionDuration = string.Format("{0}s", 0); sizeElements(); }; }
public Application() { NavigationBar = new HTMLDivElement(); NavigationBar.className = "nar-bar"; // Each Button is 25% of the screen... SetupNavButtons( (ButtonNewsFeed = new HTMLButtonElement() { innerText = "Today's News" }), (ButtonCompanies = new HTMLButtonElement() { innerText = "Companies" }), (ButtonMyProfile = new HTMLButtonElement() { innerText = "My Profile" }), (ButtonContact = new HTMLButtonElement() { innerText = "Contact" })); document.body.appendChild(NavigationBar); }
public BootWindow(params Union <string, Control, HTMLElement>[] typos) : base("") { if (assignedBootWindow == string.Empty) { assignedBootWindow = CreateWindowHandle().ToString(); } responsiveClass = GetResponsiveClass(); privateSyle = new HTMLStyleElement(); this.Body.AppendChild(privateSyle); var container = (new BootStyleWidget("container")); // fluid this.BackColor = Color.White; this.Body.AppendChild(container.Content); this.BodyStyle.OverflowY = Overflow.Auto; this.BodyStyle.OverflowX = Overflow.Hidden; prevBody = this.Body; this.Body = (HTMLDivElement)container.Content; this.BodyStyle.Padding = "0"; SetCalcSize(); if (typos != null) { int length = typos.Length; for (int i = 0; i < length; i++) { if (typos[i].Is <string>()) { this.Body.AppendChild(Document.CreateTextNode((string)typos[i])); } else if (typos[i].Is <Control>()) { if (typos[i].Is <Navbar>()) { makeChangesForNav((Navbar)typos[i]); } else { this.Body.AppendChild((Control)typos[i]); } } else if (typos[i].Is <HTMLElement>()) { if (((HTMLElement)typos[i]).TagName.ToUpper() == "NAV") { makeChangesForNav(BootWidget.CastElement <Navbar>((HTMLElement)typos[i])); } else { this.Body.AppendChild((HTMLElement)typos[i]); } } } } }
public Dropdown() { InnerElement = Div(_("tss-dropdown")); _errorSpan = Span(_("tss-dropdown-error")); _container = Div(_("tss-dropdown-container"), InnerElement, _errorSpan); _childContainer = Div(_()); InnerElement.onclick = (e) => { StopEvent(e); if (!IsVisible) { Show(); } }; _container.onclick = (e) => { StopEvent(e); if (!IsVisible) { Show(); } }; _selectedChildren = new ObservableList <Item>(); }
static void InitMenuUI() { divMenu = Document.CreateElement <HTMLDivElement>("div"); divMenu.Style.Position = "absolute"; divMenu.Style.Top = "0px"; Document.Body.AppendChild(divMenu); }
public static void Main() { var divdata = new HTMLDivElement(); divdata.innerHTML = "This is an example web game that uses MonoGame, it just uses a prototype that @Jjagg and me made in like 3h for a gamejam, and than didn't have the time to finish it...<br><br>Once in game press space to spawn enemies.<br><br>Green screen means that the game is loading, I didn't want to bother implementing a custom loading screen.<br><br>"; document.body.appendChild(divdata); var button = new HTMLButtonElement(); button.innerHTML = "Run Game"; divdata.appendChild(button); var brelem = new HTMLBRElement(); document.body.appendChild(brelem); var canvas = new HTMLCanvasElement(); canvas.width = 1024; canvas.height = 576; canvas.id = "monogamecanvas"; document.body.appendChild(canvas); button.onclick = (ev) => { game = new Game1(); game.Run(); document.body.removeChild(divdata); document.body.removeChild(brelem); }; }
public LoopDisplay(HTMLDivElement displayHost) { this.displayHost = displayHost; this.Mesh = new Mesh(10, 10, MeshType.Square); displayHost.OnMouseDown = LoopDisplay_MouseDown; displayHost.OnMouseUp = LoopDisplay_MouseUp; displayHost.OnMouseLeave = LoopDisplay_MouseLeave; displayHost.OnMouseMove = LoopDisplay_MouseMove; displayHost.OnContextMenu = LoopDisplay_ContextMenu; cellColorCanvas = Document.CreateElement <HTMLCanvasElement>("canvas"); cellColorCanvas.Style.Position = Position.Absolute; cellColorCanvas.Style.ZIndex = "1"; cellNumberCanvas = Document.CreateElement <HTMLCanvasElement>("canvas"); cellNumberCanvas.Style.Position = Position.Absolute; cellNumberCanvas.Style.ZIndex = "2"; edgeCanvas = Document.CreateElement <HTMLCanvasElement>("canvas"); edgeCanvas.Style.Position = Position.Absolute; edgeCanvas.Style.ZIndex = "3"; intersectionCanvas = Document.CreateElement <HTMLCanvasElement>("canvas"); intersectionCanvas.Style.Position = Position.Absolute; intersectionCanvas.Style.ZIndex = "4"; displayHost.AppendChild(cellColorCanvas); displayHost.AppendChild(cellNumberCanvas); displayHost.AppendChild(edgeCanvas); displayHost.AppendChild(intersectionCanvas); }
public VirtualizedList(int rowsPerPage = 4, int columnsPerRow = 4) { if (rowsPerPage <= 0) { throw new ArgumentOutOfRangeException(nameof(rowsPerPage)); } if (columnsPerRow <= 0) { throw new ArgumentOutOfRangeException(nameof(columnsPerRow)); } _listPageCache = new ListPageCache <IComponent>(rowsPerPage, columnsPerRow, CreatePageHtmlElement, CreateComponentContainerHtmlElement); _pagesToVirtualizeUpperBoundary = (int)Floor((double)PagesToVirtualize / 2); _pagesToVirtualizeLowerBoundary = (int)Ceiling((double)PagesToVirtualize / 2); _componentHeightInPercentage = GetComponentSize(rowsPerPage); _componentWidthInPercentage = GetComponentSize(columnsPerRow); _innerElement = CreateInnerElementHtmlDivElement(); _basicListContainer = CreateBasicListContainerHtmlDivElement(); _topSpacingDiv = CreateTopSpacingHtmlDivElement(); _bottomSpacingDiv = CreateBottomSpacingHtmlDivElement(); _innerElement.appendChild(_basicListContainer); AppendChildrenToBasicListContainerHtmlDivElement(_topSpacingDiv, _bottomSpacingDiv); }
/// <summary> /// Play a sprite when clicked and track the progress. /// </summary> /// <param name="spriteName">Name in a sprite object.</param> public void Play(string spriteName) { // Play the sprite sound and capture the ID. var id = _sound.play(spriteName); // Create a progress element and begin visually tracking it. var elm = new HTMLDivElement { id = id.ToString(), className = "progress", dataset = { [DataSetSpriteProp] = spriteName }, }; _spriteElms[spriteName].appendChild(elm); _sounds.Add(elm); // When this sound is finished, remove the progress element. _sound.once("end", () => { if (_sounds.Remove(elm)) { _spriteElms[spriteName].removeChild(elm); } }, id); }
public static void Main() { var divNamaKelas = new HTMLDivElement(); divNamaKelas.InnerHTML = Kelas; var buttonRandomizeKelas = new HTMLButtonElement() { InnerHTML = "Randomize Kelas" }; buttonRandomizeKelas.AddEventListener(EventType.Click, RandomizeKelas); var buttonRandomize2GroupKelas = new HTMLButtonElement() { InnerHTML = "Randomize 2 Group Kelas" }; buttonRandomize2GroupKelas.AddEventListener(EventType.Click, Randomize2GrupKelas); // Add the Button to the page Document.Body.AppendChild(divNamaKelas); Document.Body.AppendChild(buttonRandomizeKelas); Document.Body.AppendChild(buttonRandomize2GroupKelas); }
public static void Main() { document.body.setAttribute("style", "margin: 0; overflow: hidden;"); var div = new HTMLDivElement(); div.setAttribute("style", "width: 960px; height: 540px;"); var button = new HTMLButtonElement(); button.innerHTML = "Run Game"; button.setAttribute("style", "width: 100%; height: 100%; background-color: rgb(100, 149, 237); color: rgb(255, 255, 255); font-size: 20px; border: 0;"); document.body.appendChild(div); div.appendChild(button); button.onclick = (ev) => { var canvas = new HTMLCanvasElement(); canvas.width = 960; canvas.height = 540; canvas.id = "monogamecanvas"; div.removeChild(button); div.appendChild(canvas); _game = new Game1(); _game.Run(); canvas.focus(); }; }
public HTMLBoxStructure(HTMLDivElement div = null) : base() { list = new List <HTMLBox> (); if (div != null) { this.div = div; parRel = true; } else { this.div = new HTMLDivElement(); this.div.Style.Position = Position.Fixed; this.div.Style.Top = "0px"; this.div.Style.Left = "0px"; Document.Body.AppendChild(this.div); parRel = false; } this.div.OnLoad += delegate { sizeElements(); }; Window.OnResize += delegate { sizeElements(); }; }
static void Main() { var div = new HTMLDivElement(); div.style.width = "800px"; div.style.height = "480px"; document.body.appendChild(div); var button = new HTMLButtonElement(); button.innerHTML = "Click on game area to start it!"; button.style.width = "100%"; button.style.height = "100%"; button.style.backgroundColor = "#000000"; button.style.color = "#ffffff"; button.style.fontSize = "20px"; div.appendChild(button); button.onclick = (ev) => { div.removeChild(button); var canvas = new HTMLCanvasElement(); canvas.style.width = "100%"; canvas.style.height = "100%"; canvas.id = "monogamecanvas"; div.appendChild(canvas); game = new GameProject.Game1(); game.Run(); }; }
public static void OnLoad() { #if DEBUG Document.GetElementById <HTMLDivElement>("DebugFlag").Hidden = false; #endif Document.GetElementById <HTMLDivElement>("D_JsWarn").Remove(); string useragent = Window.Navigator.UserAgent.ToLower(); if (useragent.Contains("msie") || useragent.Contains("trident")) { Document.GetElementById <HTMLDivElement>("D_IeWarn").Hidden = false; } loader = Document.GetElementById <HTMLDivElement>("loaderDiv"); LoaderText = Document.GetElementById <HTMLParagraphElement>("LoadingText"); string type = GetUriVar("type"); if (type != null) { if (!App.ValidAutoThemeParts.ContainsStr(type)) { Window.Alert("The selected theme type isn't supported, probably you followed an invalid url"); return; } string Url = GetUriVar("dds"); if (Url == null) { Window.Alert("No url for the DDS has been specified"); return; } string layout = GetUriVar("layout"); DoAutoTheme(type, Url, layout); } //todo : dynamically add options for the layout }
public static void RefactoredLogin(WebUtil w, string username, string password) { HTMLDivElement loginDiv = w.GetElementById("loginForm") as HTMLDivElement; if (loginDiv != null) { IHTMLElementCollection inputs = loginDiv.getElementsByTagName("input"); foreach (IHTMLElement element in inputs) { if (element is HTMLInputElement) { HTMLInputElement input = element as HTMLInputElement; switch (input.name) { case "username": input.value = username; break; case "password": input.value = password; break; case "login": w.submitClick(input as IHTMLElement); break; } } } } }
static void AddImageToPage(ImageData tex, string Id) { HTMLDivElement div = new HTMLDivElement(); div.ClassName = "col"; div.Style.Padding = "5px"; HTMLCanvasElement c = new HTMLCanvasElement(); c.Id = Id; c.ClassName = "CustomCanvas"; c.Style.BackgroundColor = "#FAFAFA"; ImageEncoding.ImageType imgType = ImageEncoding.ImageTypesByID[t.NameToImageID(Id)]; c.Height = imgType.s.y; c.Width = imgType.s.x; c.OnClick = ImageCanvasClick; c.Style.Margin = "auto"; c.Style.Border = "black 3px solid"; div.AppendChild(MakeImageLabel(Id, imgType.s.x.ToString() + "x" + imgType.s.y.ToString())); if (Id != Theme.Name_TopScr && Id != Theme.Name_BotScr) { div.AppendChild(MakeImageEnableCheckBox(Id, tex != null)); } else { HtmlCanvasFitSize(c, imgType.s); } div.AppendChild(c); ImagesDiv.AppendChild(div); if (tex != null) { ((CanvasRenderingContext2D)c.GetContext("2d")).PutImageData(tex, 0, 0); } }
public static async void Start() { await LoadFromStorage(); cross = await BridgeEssentials.LoadImage("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QA/wD/AP+gvaeTAAAAB3RJTUUH4QUVEx4JDRbQCAAAAzNJREFUeNrt3cFt4zAQBdCfxRbhdBHAhcSXACnDZaSCPfsYIAWkigBpYS/BAt4euAdJgOLVSCNyKJGc/wHdbIrzH2I7sBIBDMMwDMMwjH3uNA8KKU92mJS+Zh8TUhdwmNTOfirPcwDwDOABwB8AbwA+hg0QpcsNxhHAE7ruPgG8ousufvH+OATgPQBhdPwOwOPoMe4Tvh+PfUfjzt77LuP6Gi1+vll4OL4C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ement(); //HTMLInputElement input = new HTMLInputElement(); //HTMLInputElement file = new HTMLInputElement //{ // Type = InputType.File //}; //start.AppendChild(input); //start.AppendChild(new Text(" or")); //start.AppendChild(new HTMLBRElement()); //start.AppendChild(file); Document.Body.InnerHTML = ""; var start = new HTMLDivElement(); start.AppendChild(new HTMLButtonElement { InnerHTML = "Create Level", OnClick = e => CreateLevel() }); start.AppendChild(CreateLevelSelectDiv(SelectLevel)); Document.Body.AppendChild(start); }
private static HTMLElement BuildBody(IFormView <HTMLElement> newMaster) { var result = new HTMLDivElement(); var templateWithParams = BuildTemplateAndParams(newMaster.Render(result)); Logger.Debug(typeof(FormCanvasExtensions), "BuildBody() got template={0} and params={1}", templateWithParams.Item1, templateWithParams.Item2.Values.PrettyToString()); result.InnerHTML = templateWithParams.Item1; foreach (var idToView in templateWithParams.Item2) { var id = idToView.Key + ""; var toBeReplaced = result.FindContainedElementByIdOrNull(id); var replaceTo = idToView.Value; //Logger.Debug(typeof(FormCanvasExtensions),"BuildBody() will replace {0} having id={1} with iview {2}", toBeReplaced.InnerHTML, id, replaceTo.InnerHTML); toBeReplaced.ParentNode.ReplaceChild( replaceTo, toBeReplaced); //Logger.Debug(typeof(FormCanvasExtensions),"BuildBody() replaced and container is now {0}", result.InnerHTML); } Logger.Debug(typeof(FormCanvasExtensions), "BuildBody() ending"); return(result); }
public EditableArea(string text = string.Empty) { _labelText = Span(_("tss-editablelabel-textspan", text: text, title: "Click to edit")); _editIcon = I(_("tss-editablelabel-edit-icon las la-edit")); _labelView = Div(_("tss-editablelabel-displaybox"), _labelText, _editIcon); InnerElement = TextArea(_("tss-editablelabel-textbox", type: "text")); _cancelEditIcon = Div(_("tss-editablelabel-cancel-icon", title: "Cancel edit"), I(_("las la-times"))); _editView = Div(_("tss-editablelabel-editbox"), InnerElement, _cancelEditIcon); _container = Div(_("tss-editablelabel"), _labelView, _editView); AttachChange(); AttachInput(); AttachFocus(); AttachBlur(); AttachKeys(); _labelView.addEventListener("click", BeginEditing); _cancelEditIcon.addEventListener("click", CancelEditing); OnKeyUp((_, e) => { if (e.key == "Escape") { CancelEditing(); } }); OnBlur((_, __) => window.setTimeout(SaveEditing, 150)); // We need to do this on a timeout, because clicking on the Cancel would trigger this method first, with no opportunity to cancel }
private void InitComponents(string label) { InitCheckboxItem(); InitLabel(label); InitButtonDel(); _divMainItem = CreateHTMLItem(); }
public static void Main() { // HTML ResultBox = Document.GetElementById <HTMLDivElement>("expr-resultbox"); InputExpression = Document.GetElementById <HTMLInputElement>("tExpression"); InputExpression.OnInput = OnInputExpression; OnInputExpression(null); // INSTRUCTIONS // ============= // // After building (Ctrl + Shift + B) this project, // browse to the /bin/Debug or /bin/Release folder. // // A new bridge/ folder has been created and // contains your projects JavaScript files. // // Open the bridge/index.html file in a browser by // Right-Click > Open With..., then choose a // web browser from the list. // // This application will then run in the browser // and you will be able to test it. // }
public Game(HTMLElement element) { _element = element; window.document.title = Name; wrapper = (HTMLDivElement)window.document.createElement("DIV"); wrapper.className = "vtjGame"; element.appendChild(wrapper); canvas = (HTMLCanvasElement)window.document.createElement("CANVAS"); wrapper.appendChild(canvas); var toolbar = window.document.createElement("DIV"); toolbar.className = "vtjToolbar"; element.appendChild(toolbar); var title = (HTMLSpanElement)window.document.createElement("SPAN"); title.innerHTML = Name; toolbar.appendChild(title); if (window.localStorage != null) { var s = (GameSettings)window.JSON.parse(window.localStorage.getItem("GameSettings")); if (s != null) settings = s; } if (!(dynamic)settings) settings = new GameSettings(); window.addEventListener("resize", (e) => { refresh(); }, false); var m = buildMenus(); if ((dynamic)m && (dynamic)m.length) { foreach (var menu in m) { menu.Render(toolbar); menu.changed += menuChanged; } } refresh(); }
private void Write(string expr, HTMLDivElement el) { el.InnerHTML = expr; }
public Layout(PlotSettings settings) { var plotter = new TinyPlotter(settings); var exprInput = new HTMLInputElement { Type = InputType.Text }; exprInput.Value = "sin(3x)"; var evalInput = new HTMLInputElement { Type = InputType.Text }; evalInput.Value = "plus(5^2, sin(div(pi, 2)))"; var variableInput = new HTMLInputElement { Type = InputType.Text }; variableInput.Value = "x"; var deltaXInput = new HTMLInputElement { Type = InputType.Text }; deltaXInput.Value = "0.005"; var xminInput = new HTMLInputElement { Type = InputType.Text }; xminInput.Value = settings.Viewport.XMin.ToString(); var xmaxInput = new HTMLInputElement { Type = InputType.Text }; xmaxInput.Value = settings.Viewport.XMax.ToString(); var yminInput = new HTMLInputElement { Type = InputType.Text }; yminInput.Value = settings.Viewport.YMin.ToString(); var ymaxInput = new HTMLInputElement { Type = InputType.Text }; ymaxInput.Value = settings.Viewport.YMax.ToString(); var resultDiv = new HTMLDivElement(); resultDiv.Style.FontSize = "18px"; resultDiv.Style.MaxWidth = "300px"; var btnPlot = new HTMLButtonElement { InnerHTML = "Plot with derivative", OnClick = ev => { Func<HTMLInputElement, bool> IsNaN = x => double.IsNaN(Script.ParseFloat(x.Value)); var isNotValid = exprInput.Value == "" || variableInput.Value == "" || IsNaN(deltaXInput) || IsNaN(xminInput) || IsNaN(xmaxInput) || IsNaN(yminInput) || IsNaN(ymaxInput); if (isNotValid) { Write("<h1 style='color:red'>Input is not valid!</h1>", resultDiv); return; } var result = Parser.TryParseInput(exprInput.Value); if (result.WasSuccessful) { // set the settings plotter.Settings.StepX = Script.ParseFloat(deltaXInput.Value); plotter.Settings.Viewport.XMin = Script.ParseFloat(xminInput.Value); plotter.Settings.Viewport.XMax = Script.ParseFloat(xmaxInput.Value); plotter.Settings.Viewport.YMin = Script.ParseFloat(yminInput.Value); plotter.Settings.Viewport.YMax = Script.ParseFloat(ymaxInput.Value); resultDiv.InnerHTML = ""; var f = result.Value; var df = Expr.Differentiate(f, variableInput.Value); var fLambda = Expr.Lambdify(f, variableInput.Value); var dfLambda = Expr.Lambdify(df, variableInput.Value); var curveColor = RandomColor(); plotter.Settings.Curves.Clear(); plotter.Settings.Curves.Add(new Curve { Map = fLambda, Color = curveColor }); plotter.Settings.Curves.Add(new Curve { Map = dfLambda, Color = Grayscale(curveColor) }); plotter.Draw(); var rgbCurveColor = RGB(curveColor); var rgbGrayColor = RGB(Grayscale(curveColor)); var msgParsed = "<strong style='color:" + rgbCurveColor + "'>" + f.ToString() + "</strong>"; var derivative = "<strong style='color:" + rgbGrayColor + "'>" + df.ToString() + "</strong>"; Write("<hr /> Parsed: <br />" + msgParsed + "<br /> Derivative: <br /> " + derivative + "<hr />", resultDiv); } else { var error = string.Join("<br />", result.Expectations); Write("<h1 style='color:red'>" + error + "</h1>", resultDiv); } } }; var btnEvaluate = new HTMLButtonElement { InnerHTML = "Evaluate", OnClick = ev => { if (evalInput.Value == "") { Write("<h1 style='color:red'>Input is not valid!</h1>", resultDiv); return; } var result = Parser.TryParseInput(evalInput.Value); if (result.WasSuccessful) { resultDiv.InnerHTML = ""; var expression = result.Value; var eval = Expr.Evaluate(expression); Write("<h4 style='color:green'>" + "Parsed: " + expression.ToString() + "<br />" + "Answer: " + eval.ToString() + "</h4>", resultDiv); } else { var error = string.Join("<br />", result.Expectations); Write("<h1 style='color:red'>" + error + "</h1>", resultDiv); } } }; var slider = new HTMLInputElement { Type = InputType.Range }; btnEvaluate.Style.Width = "90%"; btnEvaluate.Style.Margin = "5px"; btnEvaluate.Style.Height = "40px"; btnPlot.Style.Margin = "5px"; btnPlot.Style.Height = "40px"; btnPlot.Style.Width = "90%"; var layout = Table( Row(Table( Row(Label("Expression"), exprInput), Row(Label("Variable"), variableInput), Row(Label("XAxis step"), deltaXInput), Row(Label("XMin"), xminInput), Row(Label("XMax"), xmaxInput), Row(Label("YMin"), yminInput), Row(Label("YMax"), ymaxInput), Row(btnPlot, 2), Row(new HTMLHRElement(), 2), Row(Label("Expression"), evalInput), Row(btnEvaluate, 2), Row(resultDiv, 2)), Table( Row(plotter.Canvas))) ); this.container = layout; }
public bool isItemFound(HTMLDivElement divElement) { if (divElement == null) { return false; } //var itemBoxChilds = divElement.childNodes; //foreach (HTMLDivElement el in itemBoxChilds) //{ // var itemChilds = el.childNodes; // foreach (HTMLDivElement item in itemChilds) // { // object divClassAttr = item.getAttribute("className", 0); // if (divClassAttr == null) // { // continue; // } // string divClassName = (string)divClassAttr.ToString(); // if (divClassName == "") // { // continue; // } // object divItemIDAttr = item.getAttribute("nid", 0); // if (divItemIDAttr == null) // { // continue; // } // string divItemID = (string)divClassName.ToString(); // if (divItemID == "") // { // continue; // } // if (divItemID == "col item icon-datalink") // { // //tbContentDIV = el; // break; // } // } //} //foreach (HTMLDivElement item in (IHTMLElementCollection)itemChilds) //{ // object divClassAttr = item.getAttribute("className", 0); // if (divClassAttr == null) // { // continue; // } // string divClassName = (string)divClassAttr.ToString(); // if (divClassName == "") // { // continue; // } // object divItemIDAttr = item.getAttribute("nid", 0); // if (divItemIDAttr == null) // { // continue; // } // string divItemID = (string)divClassName.ToString(); // if (divItemID == "") // { // continue; // } // if (divItemID == "col item icon-datalink") // { // //tbContentDIV = el; // break; // } //} return true; }