public static void DefineNiceController() { AngularJSDemo.hwbApp.Controller<ControllerDataObjectStructure> ("hwcSctl", CtlFunction); var ctlDiv = new DivElement(); ctlDiv.SetNGController("hwcSctl"); Document.Body.AppendChild(ctlDiv); var fltFld = new InputElement(); fltFld.SetNGModel("hwcFlt"); ctlDiv.AppendChild(fltFld); var ordFld = new SelectElement(); ordFld.SetNGModel("hwcOrderBy"); ordFld.Add(new OptionElement() { Value = "Checkpoint", InnerHTML = "Alphabetically" }); ordFld.Add(new OptionElement() { Value = "id", InnerHTML = "Series ID" }); ctlDiv.AppendChild(ordFld); var rptSpan = new SpanElement(); rptSpan.SetNGRepeat("checkpoint", "checkpoints", fltFld.GetNGModel(), ordFld.GetNGModel()); rptSpan.InnerHTML = "{{checkpoint.callsign}}[{{checkpoint.id}}] "; ctlDiv.AppendChild(rptSpan); }
public override void Init() { DivElement div = new DivElement( ) { InnerHTML = @" W = translate | E = rotate | + = increase size | - = decrise seize <br /> Press Q to toggle world/local space" }; Container.AppendChild(div); renderer = new THREE.WebGLRenderer(); renderer.setSize(Width, Height); renderer.sortObjects = false; Container.AppendChild(renderer.domElement); // camera = new THREE.PerspectiveCamera(70, Width /Height, 1, 3000); camera.position.set(1000, 500, 1000); camera.lookAt(new THREE.Vector3(0, 200, 0)); scene = new THREE.Scene(); scene.add(new THREE.GridHelper(500, 100)); var light = new THREE.DirectionalLight(0xffffff, 2); light.position.set(1, 1, 1); scene.add(light); THREE.Texture texture = THREE.ImageUtils.loadTexture("textures/crate.gif", THREE.MappingMode.UVMapping, base.Render); //render texture.mapping = THREE.MappingMode.UVMapping; texture.anisotropy = renderer.getMaxAnisotropy(); var geometry = new THREE.BoxGeometry(200, 200, 200); THREE.Material material = new THREE.MeshLambertMaterial(); material.map = texture; controls = new THREE.TransformControls(camera, renderer.domElement); controls.addEventListener("change", base.Render); var mesh = new THREE.Mesh(geometry, material); scene.add(mesh); controls.attach(mesh); scene.add(controls); CreateTrackball(); Window.AddEventListener("keydown", this.SwitchCase, false); }
public static void Main() { // A root container for the elements we will use in this example - // text input and two buttons var div = new Bridge.Html5.DivElement(); // Create an input element, with Placeholder text // and KeyPress listener to call Save method after Enter key pressed var input = new Bridge.Html5.InputElement() { Id = "number", Type = InputType.Text, Placeholder = "Enter a number to store...", Style = { Margin = "5px" } }; input.AddEventListener(EventType.KeyPress, InputKeyPress); div.AppendChild(input); // Add a Save button to save entered number into Storage var buttonSave = new Bridge.Html5.ButtonElement() { Id = "save", InnerHTML = "Save" }; buttonSave.AddEventListener(EventType.Click, Save); div.AppendChild(buttonSave); // Add a Restore button to get saved number and populate // the text input with its value var buttonRestore = new Bridge.Html5.ButtonElement() { Id = "restore", InnerHTML = "Restore", Style = { Margin = "5px" } }; buttonRestore.AddEventListener(EventType.Click, Restore); div.AppendChild(buttonRestore); // Do not forget add the elements on the page Document.Body.AppendChild(div); // It is good to get the text element focused input.Focus(); }
public static Element[] CreateDateTimeField() { var label = new LabelElement { HtmlFor = "dateTimeInput", InnerHTML = "Server Date and Time:" }; var div = new DivElement { ClassName = "input-group" }; var spanPrefix = new SpanElement { ClassName = "input-group-addon glyphicon glyphicon-time" }; var spanSuffix = new SpanElement { ClassName = "input-group-btn" }; var button = new ButtonElement { Type = ButtonType.Button, ClassName = "btn btn-primary", InnerHTML = "<span class=\"glyphicon glyphicon-refresh\"></span>", OnClick = Html5App.UpdateButton_Click }; var input = new InputElement { Id = "dateTimeInput", Type = InputType.Text, ClassName = "form-control", Placeholder = "Click update...", ReadOnly = true, Name = "datetime" }; spanSuffix.AppendChild(button); div.AppendChild(spanPrefix); div.AppendChild(input); div.AppendChild(spanSuffix); return new Element[] { label, div }; }
public static DivElement CreateFormField(string name, string glyph) { var div = new DivElement { ClassName = "input-group", Style = { MarginBottom = "10px" } }; var span = new SpanElement { ClassName = "glyphicon glyphicon-" + glyph + " input-group-addon" }; Element input; var placeholder = name + "..."; if (name == "Message") { input = new TextAreaElement { Name = name.ToLowerCase(), Placeholder = placeholder, Required = true, ClassName = "form-control" }; } else { input = new InputElement { Type = InputType.Text, Name = name.ToLowerCase(), Placeholder = placeholder, Required = true, ClassName = "form-control" }; } div.AppendChild(span); div.AppendChild(input); return div; }
public static void TestUseCase(Assert assert) { assert.Expect(3); var root = Document.GetElementById("qunit-fixture"); var button1 = new ButtonElement(); button1.InnerHTML = "Button 1"; button1.Id = "button1"; button1.Style.Color = HTMLColor.Green; root.AppendChild(button1); var b1 = Document.GetElementById("button1"); assert.Equal(b1.Style.Color, "green", "b1.Style.Color green"); var button2 = new ButtonElement(); button2.InnerHTML = "Button 2"; button2.Id = "button2"; button2.Style.BackgroundColor = "yellow"; root.AppendChild(button2); var b2 = Document.GetElementById("button2"); assert.Equal(b2.Style.BackgroundColor, HTMLColor.Yellow, "b2.Style.BackgroundColor HTMLColor.Yellow"); var hexColor = "#FFEEAA"; var divElement1 = new DivElement(); divElement1.InnerHTML = "Div 1"; divElement1.Id = "div1"; divElement1.Style.Color = hexColor; root.AppendChild(divElement1); var div1 = Document.GetElementById("div1"); assert.Equal(div1.Style.Color, "rgb(255, 238, 170)", "div1.Style.Color " + hexColor); }
public static DivElement CreatePanelHeader() { var header = new DivElement { ClassName = "panel-heading logo" }; var title = new HeadingElement { InnerHTML = "Bridge.NET HTML5 Demo" }; header.AppendChild(title); return header; }
public static DivElement CreatePanelFooter() { var footer = new DivElement { ClassName = "panel-footer text-right" }; var button = new InputElement { Type = InputType.Submit, Value = "Submit", ClassName = "btn btn-success", FormAction = Config.SUBMIT_URL, FormMethod = "POST" }; footer.AppendChild(button); return footer; }
public static DivElement CreatePanelBody() { var body = new DivElement { ClassName = "panel-body" }; var name = Html5App.CreateFormField("Name", "user"); var email = Html5App.CreateFormField("Email", "globe"); var message = Html5App.CreateFormField("Message", "pencil"); Element[] dateTime = Html5App.CreateDateTimeField(); body.AppendChild(name); body.AppendChild(email); body.AppendChild(message); body.AppendChild(dateTime[0]); body.AppendChild(dateTime[1]); return body; }
public static DivElement CreatePanel() { var panel = new DivElement { ClassName = "panel panel-default" }; var header = Html5App.CreatePanelHeader(); var body = Html5App.CreatePanelBody(); var footer = Html5App.CreatePanelFooter(); panel.AppendChild(header); panel.AppendChild(body); panel.AppendChild(footer); return panel; }
public static Element GetRepeatRegion() { var itemsSpan = new SpanElement(); itemsSpan.InnerHTML = "Checkpoint"; var itemsPara = new ParagraphElement(); itemsPara.InnerHTML = "{{checkpoint.callsign}}[{{checkpoint.id}}]"; var itemsLI = new LIElement(); itemsLI.SetNGRepeat("checkpoint", "checkpoints"); itemsLI.AppendChild(itemsSpan); itemsLI.AppendChild(itemsPara); var itemsUL = new UListElement(); itemsUL.AppendChild(itemsLI); var itemsSubSpan = new SpanElement() { InnerHTML = "[{{checkpoint.callsign}}.{{checkpoint.id}}] " }; var itemsSearchBox = new InputElement(); itemsSearchBox.SetNGModel("cpFilter"); var itemsOrderSelector = GetOrderBySelector("cpOrderBy"); itemsSubSpan.SetNGRepeat("checkpoint", "checkpoints", itemsSearchBox.GetNGModel(), itemsOrderSelector.GetNGModel()); var itemsDiv = new DivElement(); itemsDiv.SetNGController("hwbSctl"); itemsDiv.AppendChild(itemsUL); itemsDiv.AppendChild(itemsSearchBox); itemsDiv.AppendChild(itemsOrderSelector); itemsDiv.AppendChild(itemsSubSpan); return itemsDiv; }
public void Initialize() { ConsoleLog = Document.GetElementById<DivElement>("consoleLog"); WebSocketSupportImage = Document.GetElementById<ImageElement>("wsSupportImg"); WebSocketSupported = Document.GetElementById<DivElement>("webSocketSupp"); WebSocketNotSupported = Document.GetElementById<DivElement>("noWebSocketSupp"); UseSecureWebSocketInput = Document.GetElementById<InputElement>("secureCb"); UseSecureWebSocketInput.Checked = false; UseSecureWebSocketInput.OnClick += OnClick_UseSecureWebSocket; LocationInput = Document.GetElementById<InputElement>("wsUri"); MessageInput = Document.GetElementById<InputElement>("sendMessage"); ConnectButton = Document.GetElementById<ButtonElement>("connect"); ConnectButton.OnClick += OnClick_ConnectButton; DisconnectButton = Document.GetElementById<ButtonElement>("disconnect"); DisconnectButton.OnClick += OnClick_DisconnectButton; SendButton = Document.GetElementById<ButtonElement>("send"); SendButton.OnClick += OnClick_SendButton; ClearLogButton = Document.GetElementById<ButtonElement>("clearLogBut"); ClearLogButton.OnClick += OnClick_ClearLogButton; Window.OnBeforeUnload += (e) => { if (OnViewShuttingUp != null) { OnViewShuttingUp(this, new EventArgs()); } }; if (OnViewInitialized != null) { OnViewInitialized(this, new EventArgs()); } }
/// <summary> /// Ensures the div element with qunit-fixture exists. /// QUnit automatically cleans qunit-fixture div after each test. You should only rely on the fixture markup, inside the #qunit-fixture element. /// </summary> /// <returns></returns> private static DivElement EnsureTestFixture() { var fixture = Bridge.Html5.Document.GetElementById<DivElement>("qunit-fixture"); if (fixture == null) { fixture = new DivElement() { Id = "qunit-fixture" }; Document.Body.AppendChild(fixture); } return fixture; }
public static ModalDlg Make(string titleText, string bodyText, string id) { DivElement myModal = new DivElement(); myModal.ClassName = "modal fade"; myModal.Id = id; myModal.SetAttribute("role", "dialog"); jQuery jq = new jQuery(myModal).On("hidden.bs.modal", OnHidden); DivElement modalDlg = new DivElement(); modalDlg.ClassName = "modal-dialog-sm"; myModal.AppendChild(modalDlg); DivElement modalContent = new DivElement(); modalContent.ClassName = "modal-content"; modalDlg.AppendChild(modalContent); DivElement modalHeader = new DivElement(); modalHeader.ClassName = "modal-header"; modalContent.AppendChild(modalHeader); ButtonElement button = new ButtonElement(); button.SetAttribute("type", "button"); button.ClassName = "close"; button.SetAttribute("data-dismiss", "modal"); button.InnerHTML = "×"; modalHeader.AppendChild(button); HeadingElement title = new HeadingElement(HeadingType.H4); title.ClassName = "modal-title"; title.InnerHTML = titleText; modalHeader.AppendChild(title); DivElement modalBody = new DivElement(); modalBody.ClassName = "modal-body"; modalContent.AppendChild(modalBody); ParagraphElement bodyContent = new ParagraphElement(); bodyContent.InnerHTML = bodyText; modalBody.AppendChild(bodyContent); DivElement footer = new DivElement(); footer.ClassName = "modal-footer"; ButtonElement footerButton = new ButtonElement(); footerButton.SetAttribute("type", "button"); footerButton.ClassName = "btn btn-default"; footerButton.SetAttribute("data-dismiss", "modal"); footerButton.InnerHTML = "Close"; footer.AppendChild(footerButton); modalContent.AppendChild(footer); Document.Body.AppendChild(myModal); ModalDlg dlg = new ModalDlg(); dlg.TopElement = myModal; dlg.Body = modalBody; dlg.Title = title; dlg.BodyContent = bodyContent; dlg.Footer = footer; dlg.id = id; return dlg; }