private void button4_Click(object sender, EventArgs e) { ingreso4 = new div(); ingreso4.D1 = double.Parse(textBox1.Text); ingreso4.D2 = double.Parse(textBox2.Text); label3.Text = ingreso4.calcular().ToString(); }
public static div GetTextarea(string label_text, string value_input, string name_input, string placeholder, bool input_readonly = false, int rows = 2, bool required = false) { div returned_input = new div(); returned_input.AddCSS("form-group"); if (!string.IsNullOrEmpty(label_text)) { returned_input.AddDomNode(new label(label_text, name_input)); } textarea ret_textarea = new textarea() { InnerText = value_input, required = required, @readonly = input_readonly }; ret_textarea.AddCSS("form-control"); if (rows > 0) { ret_textarea.rows = rows; } if (!string.IsNullOrEmpty(value_input)) { ret_textarea.InnerText = value_input; } ret_textarea.Name_DOM = name_input; returned_input.AddDomNode(ret_textarea); return(returned_input); }
public div[] GetValidationAlerts(string validation_input_id, string invalid_text = "Укажите значение", string valid_text = null) { div valid_element = new div() { InnerText = valid_text, Id_DOM = "valid-tooltip-" + validation_input_id, inline = true }; valid_element.AddCSS("valid-feedback"); div invalid_element = new div() { InnerText = invalid_text, Id_DOM = "invalid-tooltip-" + validation_input_id, inline = true }; invalid_element.AddCSS("invalid-feedback"); // if (!string.IsNullOrEmpty(valid_text)) { return new div[] { valid_element, invalid_element } } ; else { return new div[] { invalid_element } }; } }
private void getDivs(Transform parent, div div) { var i = 0; foreach (Transform child in parent) { var s = child.GetComponent <style>(); if (s == null) { continue; } s.Refresh(); s.Div.childIndex = i; s.Div.parent = div; getDivs(child, s.Div); div.children.Add(s.Div); i++; //divs.Add(s.Div.Id, s.Div); } }
public static div GetBootstrapSelectList(string label, select select_body, string Tooltip = null, string wrap_class = "input-group mb-4 col-auto") { div ret_dom = new div(); ret_dom.AddCSS(wrap_class, true); if (!string.IsNullOrEmpty(label)) { using (div input_group_prepend = new div()) { input_group_prepend.AddCSS("input-group-prepend"); ret_dom.AddDomNode(input_group_prepend); } //ret_dom.Childs[0].Childs.Add(new label(label, select_body.Id_DOM) { css_class = "input-group-text" }); } select_body.AddCSS("custom-select"); if (!string.IsNullOrEmpty(Tooltip)) { ret_dom.title = Tooltip; } ret_dom.SetAttribute("data-toggle", "tooltip"); ret_dom.AddDomNode(select_body); return(ret_dom); }
public string Chat(List <MessageDto> messageList, List <UserDto> userList) { return(Layout("chat", @$ " <body id='chat-body'> <header> <h1>My Little Game Chat</h1> </header> <nav> <form action='/logout' method='post'> <button>Logout</button> </form> <label for='channel-select'></label> <select name='channel' id='channel-select'> <option value='Best Pony'>Best Pony</option> <option value='Super Secret Place'>Super Secret Place</option> </select> </nav> <section id='chat-box'>{String.Join(" \ n ", messageList.Select(m => RenderHtmlMessage(m)))}</section> <section id='user-list'> <h4>Online Users</h4> <div id='user-box'>{String.Join(" \ n ", userList.Select(u => RenderHtmlUser(u)))}</div> </section> <section id='settings'> <h4>Settings</h4> <form action='/upload-avatar' method='post' enctype='multipart/form-data'> <label class='label-file' for='avatar'>Upload avatar</label>
public void Refresh() { _div = new div { Id = Name, elementName = gameObject.name, type = divType.div, element = GetComponent <RectTransform>(), children = new List <div>() }; }
public async Task ShouldClickAnOffscreenElementWhenScrollBehaviorIsSmooth() { await Page.SetContentAsync(@$ " <div style=" "border: 1px solid black; height: 500px; overflow: auto; width: 500px; scroll-behavior: smooth" "> <button style=" "margin-top: 2000px" " onClick=" "window.clicked = true" " >hi</button> </div>"); await Page.ClickAsync("button"); Assert.True(await Page.EvaluateAsync <bool>("window.clicked")); }
public void Calculate() { var pTransform = transform.parent.transform; var _parent = new div { Id = 0.ToString(), elementName = pTransform.gameObject.name, children = new List <div>(), type = pTransform.gameObject.name.Contains("<body") ? divType.body : divType.div, element = pTransform.GetComponent <RectTransform>() }; style_utils.getDivs(pTransform, _parent); style_utils.buildDiv(_div); }
public void GetBasicElements() { _body = new div { Id = index.ToString(), elementName = transform.gameObject.name, children = new List <div>(), type = divType.body, element = transform.GetComponent <RectTransform>() }; style_utils.SetAnchor(AnchorType.TopLeft, _body.element); _body.element.localPosition = new Vector3(-(_body.element.sizeDelta.x / 2), (_body.element.sizeDelta.y / 2), 0); style_utils.getDivs(transform, _body); }
internal async Task <string> GetOutputAsync(DataTableTagHelper tagHelper, bool debug = false) { #if DEBUG return(await GetOutputPrivateAsync(tagHelper)); #else try { return(await GetOutputPrivateAsync(tagHelper)); } catch (Exception e) { if (debug) { return(@$ " <div style=" "background-color:white;color:black;border:1px black solid;padding:5px;font-size:12pt" "> <code> {e}
private string RenderZonaDeDatos() { var mostrarExpresion = $"{(string)ElementoDto.ValorDelAtributo(typeof(TElemento), nameof(IUDtoAttribute.MostrarExpresion))}"; var expresionElemento = typeof(TElemento).GetField("ExpresionElemento"); if (expresionElemento != null) { mostrarExpresion = $"[{expresionElemento.GetValue(typeof(TElemento))}]"; } else if (typeof(TElemento).BaseType.Name != nameof(ElementoDto) && typeof(TElemento).BaseType.Name != nameof(AuditoriaDto)) { GestorDeErrores.Emitir($"Debe definir los campos que componen la 'exprexión del elemento' para el objeto {typeof(TElemento).Name}"); } var idHtmlZonaFiltro = ((DescriptorDeMantenimiento <TElemento>)Padre).Filtro.IdHtml; var htmlDiv = @$ " <!-- ******************** grid de datos ******************** --> <div id = ¨{IdHtml}¨
/// <summary> /// Добавить вложеную группу, как dropdown menus /// </summary> /// <param name="nesting">Набор вложеной группы кнопок</param> /// <param name="id_node">Уникальный идентификатор вложеного узла. Если IsNullOrEmpty => будет сгенерирован guid</param> public void AddNestingDropdownGroup(List <DataParticleItem> nesting, string title_node, string id_node = null) { if (string.IsNullOrEmpty(id_node)) { id_node = Guid.NewGuid().ToString().Replace("-", ""); } GroupElements nested_group = new GroupElements() { aria_label = "nested group - " + id_node }; button node_button = new button(title_node) { Id_DOM = id_node }; node_button.AddCSS("btn btn-" + default_style.ToString() + " dropdown-toggle", true); node_button.SetAttribute("data-toggle", "dropdown"); node_button.SetAttribute("aria-haspopup", "true"); node_button.SetAttribute("aria-expanded", "false"); nested_group.Childs.Add(node_button); div dropdown_node = new div(); dropdown_node.AddCSS("dropdown-menu"); dropdown_node.SetAttribute("aria-labelledby", id_node); foreach (DataParticleItem item in nesting) { using (a a_item = new a() { href = item.Value, InnerText = item.Title }) { a_item.AddCSS("dropdown-item"); dropdown_node.AddDomNode(a_item); } } Childs.Add(nested_group); }
public override string GetHTML(int deep = 0) { Childs.Clear(); div input_group_prepend = new div(); input_group_prepend.AddCSS("input-group-prepend"); using (div input_group_text = new div() { InnerText = LabelText }) { input_group_text.AddCSS("input-group-text"); input_group_prepend.Childs.Add(input_group_text); } Childs.Add(input_group_prepend); Childs.Add(Input); if (Input.required) { Childs.AddRange(GetValidationAlerts(Input.Name)); } return(base.GetHTML(deep)); }
/// <summary> /// Стандартная карточка/панель для размещения информации /// </summary> /// <param name="card_head">Заголовок карточки</param> /// <param name="body_elements">Элементы содержимого</param> /// <param name="css_card">Стиль офрмления карточки</param> /// <returns>Готовая карточка информации</returns> public static div Get_DIV_Bootstrap_Card(string card_head, List <base_dom_root> body_elements, string css_card = "bg-light") { div card_header = new div() { InnerText = card_head }; card_header.AddCSS("card-header"); div card_body = new div(); card_body.AddCSS("card-body"); foreach (div he in body_elements) { card_body.AddDomNode(he); } div card_set = new div(); card_set.AddCSS("card " + css_card, true); card_set.AddDomNode(card_header); card_set.AddDomNode(card_body); return(card_set); }
public static MvcHtmlString CustomModal(this HtmlHelper htmlHelper) { var modal = @"<button type="button" class="btn btn-info btn - lg" data-toggle="modal" data-target="#myModal">Open Modal</button> < div id = "myModal" class="modal fade" role="dialog">
private static string GeneratEmailContent(CreateCommentInputModel model, DetailsFireplaceViewModel fireplace, StringBuilder contentEmail, Comment comment) { contentEmail.AppendLine(@$ "Получен коментар за: <div style='font - family: inherit; text - align: inherit'><em><strong>{model.ProductName}</strong></em></div>
/// <summary> /// Получить форму регистрации/авторизации /// </summary> /// <param name="user_login_input_id">html dom id/name - идентификатор/имя input-a ввода логина</param> /// <param name="user_password_input_id">html dom id/name - идентификатор/имя input-a ввода пароля</param> /// <param name="user_password_repeat_input_id">html dom id/name - идентификатор/имя input-a ввода повтора пороля</param> /// <param name="reg_new_user_chekbox_id">html dom id/name - идентификатор/имя chekbox-a для регистрации нового пользователя</param> /// <param name="button_send_login_form_id">html dom id/name - идентификатор/имя button-a </param> /// <param name="re_captcha_key">api - ключ reCaptcha</param> /// <param name="collapse_info_new_user_input_css">css класс - области сворачивания и разворачивания для регистрации</param> /// <returns></returns> public static List <base_dom_root> GetLoginForm( string re_captcha_key = null, string user_password_input_id = "user_password_input_id", string user_password_repeat_input_id = "user_password_repeat_input_id", string user_login_input_id = "user_login_input_id", string reg_new_user_chekbox_id = "reg_new_user_chekbox_id", string button_send_login_form_id = "button_send_login_form_id", string collapse_info_new_user_input_css = "collapse_info_new_user_input") { List <base_dom_root> dom_elements = new List <base_dom_root>(); form html_response = new form() { Id_DOM = "login_form_id", target = TargetsEnum._self, method_form = MethodsFormEnum.POST }; html_response.AddCSS("was-validated"); html_response.SetAttribute("novalidate", null); TextInput textInput = new TextInput("Ваш логин", user_login_input_id) { InputInfoFooter = "Введите логин для входа" }; textInput.Input.placeholder = "Логин"; textInput.Input.required = true; html_response.AddDomNode(textInput); textInput = new TextInput("Ваш пароль", user_password_input_id) { InputInfoFooter = "Пароль для входа" }; textInput.Input.type = InputTypesEnum.password; textInput.Input.placeholder = "Пароль"; html_response.AddDomNode(textInput); textInput = new TextInput("Повторите пароль", user_password_repeat_input_id) { InputInfoFooter = "Повторно введите пароль" }; textInput.Input.type = InputTypesEnum.password; textInput.Input.placeholder = "Повтор"; textInput.AddCSS("panel-collapse collapse " + collapse_info_new_user_input_css, true); html_response.AddDomNode(textInput); html_response.Childs[html_response.Childs.Count - 1].AddCSS("panel-collapse collapse " + collapse_info_new_user_input_css, true); html_response.Childs.Add(new CheckboxInput("Зарегистрироваться", reg_new_user_chekbox_id)); p reg_new_user_info = new p(""); reg_new_user_info.AddCSS("clearfix"); using (ul panel_collapse = new ul()) { panel_collapse.AddCSS("panel-collapse collapse " + collapse_info_new_user_input_css, true); reg_new_user_info.Childs.Add(panel_collapse); } reg_new_user_info.Childs[0].Childs.Add(new li() { InnerText = "Придумайте/запомните надёжный логин/пароль и входите" }); reg_new_user_info.Childs[0].Childs.Add(new li() { InnerText = "Учётная запись будет создана автоматически" }); html_response.Childs.Add(reg_new_user_info); if (!string.IsNullOrEmpty(re_captcha_key)) { html_response.Childs.Add(new hr()); html_response.Childs.Add(new h4("Пройдите проверку reCAPTCHA")); div sitekey = new div(); sitekey.AddCSS("g-recaptcha"); sitekey.SetAttribute("data-size", "compact"); sitekey.SetAttribute("data-sitekey", re_captcha_key); html_response.Childs.Add(sitekey); } html_response.Childs.Add(GetButton("Войти", button_send_login_form_id, null, VisualBootstrapStylesEnum.primary, SizingBootstrap.Lg, true)); dom_elements.Add(Get_DIV_Bootstrap_Card("Вход/Регистрация", html_response)); return(dom_elements); }
public GoogleGearsAdvanced() { //Native.Window.alert("alert 1"); CreateStyles(); //Native.Window.alert("alert 2"); var shadow = new div { className = "shadow" }; var toolbar = new div { className = "toolbar" }; var workspace0 = new div { className = "workspace0" }; var workspace = new div { className = "workspace" }; workspace0.appendChild( new div("You can create new postcards by clicking on the background image. You can drag those postcards by their borders. You can use your mouse wheel to zoom in or out, too. All postcards will be saved via webSQL. Doubleclick a postcard to delete it.")); shadow.appendChild(workspace0, workspace, toolbar); //toolbar.innerHTML = "<a href='http://gears.google.com/'>get google gears</a> | <a href='http://jsc.sourceforge.net/'>jsc homepage</a> | <a href='http://zproxy.wordpress.com/'>blog</a>"; //AppendError(workspace0, "loading 1..."); var BackgroundTween = new TweenDataDouble(); BackgroundTween.ValueChanged += delegate { workspace.style.Opacity = BackgroundTween.Value; }; BackgroundTween.Value = 0.5; workspace.onmouseover += delegate { BackgroundTween.Value = 0; }; workspace.onmouseout += delegate { BackgroundTween.Value = 0.5; }; //AppendError(workspace0, "loading 2..."); //var cc = new SQLiteConnection(); //cc.Open(); new { }.With( async delegate { while (true) { await Native.window.async.onframe; // we are logging a lot. idle more for now await Task.Delay(500); var Count = await new xxPostcard().Create().CountAsync(); // let UI know how many we have Native.document.title = new { Count }.ToString(); // chrome style may not show title toolbar.innerText = new { Count }.ToString(); // can we do conditional css here? //toolbar.style.color = "blue"; //await toolbar.async.onclick; //// undo //toolbar.style.color = ""; } } ); new HTML.Images.FromAssets.postcard_alpha().InvokeOnComplete( postcard => new HTML.Images.FromAssets.postcard_alpha_200_unfocus().InvokeOnComplete( postcard200 => { // at this point we have the image and we know how large it is //AppendError(workspace0, "loading 3..."); // X:\jsc.svn\examples\javascript\forms\SQLiteConsoleExperiment\SQLiteConsoleExperiment\ApplicationControl.cs // X:\jsc.svn\examples\javascript\Test\TestSQLiteConnection\TestSQLiteConnection\Application.cs // Cannot read property 'transaction' of null" new xxPostcard().Create(); //catch (System.Exception exc) //{ // var err_msg = exc.Message; // AppendError(workspace0, err_msg); //} //AppendError(workspace0, "loading 4..."); #region Spawn Func <PostcardEntry, Postcard> Spawn = template => { var p2 = new Postcard(postcard, postcard200, workspace); p2.CurrentDrag.Position.X = template.X; p2.CurrentDrag.Position.Y = template.Y; p2.AttachTo(shadow); System.Console.WriteLine("new: " + p2.Id); if (template.Text == null) { template.Text = new[] { "Hello!", "Yo!", "Whuzza!", "Howdy!", "Cheers!" }.Randomize().First() + "\nWrite something here!"; } if (template.Zoom100 == 0) { template.Zoom100 = (int)System.Math.Floor((new System.Random().NextDouble() + 0.5) * 100); } p2.Content.value = template.Text; System.Console.WriteLine("SetZoom: " + new { template.Zoom100 }); p2.SetZoom(template.Zoom100 / 100.0); if (template.Id == null) { try { new xxPostcard().InsertAsync( new xxPostcardRow { Id = p2.Id, Text = p2.Text, Zoom100 = (int)System.Math.Floor(p2.Zoom * 100), X = p2.CurrentDrag.Position.X, Y = p2.CurrentDrag.Position.Y } ); } catch (System.Exception exc) { AppendError(workspace0, exc.Message); } } else { p2.Id = template.Id; } #region RightClick p2.RightClick += delegate { System.Console.WriteLine("dispose: " + p2.Id); p2.Dispose(); //db.execute("delete from Postcards where Id = ?", p2.Id); Console.WriteLine("delete:"); // 21:15078ms delete: view - source:41361 //Uncaught RangeError: Maximum call stack size exceeded ( from x in new xxPostcard() where x.Id == p2.Id select x ).Delete(); //new xPostcard().Where(x => x.Id == p2.Id).Delete(cc); Console.WriteLine("delete: done?"); }; #endregion #region DoubleClick p2.DoubleClick += delegate { System.Console.WriteLine("dispose: " + p2.Id); p2.Dispose(); //db.execute("delete from Postcards where Id = ?", p2.Id); Console.WriteLine("delete:"); ( from x in new xxPostcard() where x.Id == p2.Id select x ).Delete(); //new xPostcard().Where(x => x.Id == p2.Id).Delete(cc); Console.WriteLine("delete: done?"); }; #endregion #region Changed p2.Changed += delegate { System.Console.WriteLine("changed: " + new PostcardEntry { Id = p2.Id, Text = p2.Text, Zoom100 = (int)System.Math.Floor(p2.Zoom * 100), X = p2.CurrentDrag.Position.X, Y = p2.CurrentDrag.Position.Y }.ToString()); Console.WriteLine("delete:"); new xxPostcard().Delete(x => x.Id == p2.Id); new xxPostcard().InsertAsync( new xxPostcardRow { Id = p2.Id, Text = p2.Text, Zoom100 = (int)System.Math.Floor(p2.Zoom * 100), X = p2.CurrentDrag.Position.X, Y = p2.CurrentDrag.Position.Y } ); }; #endregion System.Console.WriteLine("item: " + template.ToString()); p2.ZoomAndMove(); p2.CurrentDrag.DragStart += delegate { p2.AttachTo(shadow); }; return(p2); }; #endregion workspace.onclick += delegate(IEvent ev) { Spawn( new PostcardEntry { X = ev.CursorX, Y = ev.CursorY } ); }; #region LoadFromDatabase new { }.With( async delegate { var query = from Data in new xxPostcard() select Data; foreach (var v in await query.AsEnumerableAsync()) { // 13:232ms {{ Text = hey, X = 355.0, Y = 243.0, Zoom100 = 30.0 }} //Console.WriteLine(new { v.Text, v.X, v.Y, v.Zoom100 }); Spawn( new PostcardEntry { Id = v.Id, Text = v.Text, X = (int)v.X, Y = (int)v.Y, Zoom100 = Math.Max(60, (int)v.Zoom100), } ); } } ); #endregion } ) ); Native.Document.body.appendChild(shadow); }
/// <summary> /// Сформировать модальное окно /// </summary> /// <param name="title">Заголовок модального окна</param> /// <param name="text_ok_button">Текст конопки Ok (если null or empty), то кнопка не выводится вовсе</param> /// <param name="id_ok_button">ID атрибут конопки Ok</param> /// <param name="text_cansel_button">Текст конопки Cancel (если null or empty), то кнопка не выводится вовсе</param> /// <param name="body_html">Тело модального окна</param> /// <param name="id_modal_dialog">ID атрибут модального окна</param> public static div GetModalDialog(string title, string text_ok_button, string text_cansel_button, base_dom_root body_html, string id_modal_dialog = "exampleModal", string id_ok_button = "button_try_write") { span span_close_modal_header = new span("×"); span_close_modal_header.SetAttribute("aria-hidden", "true"); // button button_close_modal_header = new button(null); button_close_modal_header.AddCSS("close"); button_close_modal_header.SetAttribute("data-dismiss", "modal"); button_close_modal_header.SetAttribute("aria-label", "Close"); button_close_modal_header.AddDomNode(span_close_modal_header); // h5 h5_modal_header = new h5(title); h5_modal_header.AddCSS("modal-title"); div div_modal_header = new div(); div_modal_header.AddCSS("modal-header"); div_modal_header.AddDomNode(h5_modal_header); div_modal_header.AddDomNode(button_close_modal_header); // div modal_footer = new div(); modal_footer.AddCSS("modal-footer"); if (!string.IsNullOrEmpty(text_cansel_button)) { button button_close_modal_footer = GetButton(text_cansel_button, null, null, VisualBootstrapStylesEnum.secondary); button_close_modal_footer.SetAttribute("data-dismiss", "modal"); modal_footer.AddDomNode(button_close_modal_footer); } if (!string.IsNullOrEmpty(text_ok_button)) { button button_send_modal_footer = GetButton(text_ok_button, null, "#", VisualBootstrapStylesEnum.primary); button_send_modal_footer.Id_DOM = id_ok_button; modal_footer.AddDomNode(button_send_modal_footer); } // div modal_content = new div(); modal_content.AddCSS("modal-content"); modal_content.AddDomNode(div_modal_header); // div modal_body = new div(); modal_body.AddCSS("modal-body"); modal_body.AddDomNode(body_html); modal_content.AddDomNode(modal_body); // modal_content.AddDomNode(modal_footer); // div modal_dialog_document = new div(); modal_dialog_document.AddCSS("modal-dialog"); modal_dialog_document.CustomAttributes.Add("role", "document"); modal_dialog_document.AddDomNode(modal_content); // div ModalDialog = new div() { Id_DOM = id_modal_dialog }; ModalDialog.AddCSS("modal fade", true); ModalDialog.CustomAttributes.Add("tabindex", "-1"); ModalDialog.CustomAttributes.Add("role", "dialog"); ModalDialog.CustomAttributes.Add("aria-labelledby", id_modal_dialog); ModalDialog.CustomAttributes.Add("aria-hidden", "true"); ModalDialog.AddDomNode(modal_dialog_document); ModalDialog.before_coment_block = "Modal dialog"; return(ModalDialog); }
void ITemplate.InstantiateIn(System.Web.UI.Control container) { switch (_templateType) { case ListItemType.Header: { _iField++; if (_typeCtrl != TypeTemplateCol.action && _typeCtrl != TypeTemplateCol.action_url && _typeCtrl != TypeTemplateCol.request && _typeCtrl != TypeTemplateCol.tabledel && _typeCtrl != TypeTemplateCol.tablelink) { html_ctrl fld = new html_ctrl("div", new attrs(new string[, ] { { "class", "header-col" } })); // titolo colonna attrs atrs = new attrs(new string[, ] { { "colgrid", "true" }, { "oncontextmenu", "col_contextmenu('" + _grid_id + "', '" + _fld_name + "')" } }); XmlNode h_node = refHeader(); ctrl c_title = h_node != null ? (ctrl) new link(_col_title, xmlDoc.node_val(h_node, "title") != "" ? xmlDoc.node_val(h_node, "title") : _col_des, "title-col" , _page.page.parse(h_node.Attributes["ref"].Value), atrs) : (ctrl) new label(_col_title, "title-col", _col_des, atrs); fld.add(c_title.control); // freccine ordinamento string direction; bool sorted = grid_ctrl.find_sort_field(grid_ctrl.xmlOfGrid(_page, _grid_id), _fld_name, out direction); ctrl f_ctrl = new div(null, "<div class='arrows' title=\".\" " + " field_name='" + _fld_name + "' onclick=\"updateGridSort('" + _grid_id + "', '" + _fld_name + "')\" oncontextmenu=\"col_contextmenu('" + _grid_id + "', '" + _fld_name + "')\">" + (!sorted ? "<a class='mif-arrow-up arrow-col'></a>" : (direction.ToLower() == "asc" ? "<a class='mif-arrow-up arrow-col-active'></a>" : "<a class='mif-arrow-down arrow-col-active'></a>")) + "</div>"); fld.add(f_ctrl.control); container.Controls.Add(fld.control); } } break; case ListItemType.Item: { _iField++; // creazione del controllo WebControl ctrl = null; bool notTransparent = false; if (_typeCtrl == TypeTemplateCol.text) { ctrl = refItem() != null ? new link(new EventHandler(textlink_DataBinding)).w_ctrl : new text(new EventHandler(text_DataBinding), true).w_ctrl; } else if (_typeCtrl == TypeTemplateCol.integer) { ctrl = refItem() != null ? new link(new EventHandler(intlink_DataBinding)).w_ctrl : new label(new EventHandler(int_DataBinding)).lbl; } else if (_typeCtrl == TypeTemplateCol.euro) { ctrl = refItem() != null ? new link(new EventHandler(eurolink_DataBinding)).w_ctrl : new label(new EventHandler(euro_DataBinding)).lbl; } else if (_typeCtrl == TypeTemplateCol.real) { ctrl = refItem() != null ? new link(new EventHandler(reallink_DataBinding)).w_ctrl : new label(new EventHandler(real_DataBinding)).lbl; } else if (_typeCtrl == TypeTemplateCol.check) { ctrl = new check(_page.newIdControl, new EventHandler(check_DataBinding), false).w_ctrl; } else if (_typeCtrl == TypeTemplateCol.date || _typeCtrl == TypeTemplateCol.date_hour) { if (refItem() != null) { throw new Exception("refitem non supportato per la colonna 'date'"); } else { ctrl = new label(new EventHandler(date_DataBinding)).lbl; } } else if (_typeCtrl == TypeTemplateCol.link) { ctrl = new link(new EventHandler(link_DataBinding)).w_ctrl; } else if (_typeCtrl == TypeTemplateCol.action) { notTransparent = true; ctrl = new link(new EventHandler(action_DataBinding), _icon + " icon-btn").w_ctrl; } else if (_typeCtrl == TypeTemplateCol.action_url) { notTransparent = true; ctrl = new link(new EventHandler(actionurl_DataBinding), _icon + " icon-btn").w_ctrl; } else if (_typeCtrl == TypeTemplateCol.request) { notTransparent = true; ctrl = new link(new EventHandler(request_DataBinding), _icon + " icon-btn").w_ctrl; } else if (_typeCtrl == TypeTemplateCol.tabledel) { notTransparent = true; ctrl = new link(new EventHandler(requestDel_DataBinding), _icon + " icon-btn").w_ctrl; } else if (_typeCtrl == TypeTemplateCol.tablelink) { notTransparent = true; ctrl = new link(new EventHandler(requestLink_DataBinding), _icon + " icon-btn").w_ctrl; } else { throw new Exception("campo '" + _typeCtrl.ToString() + "' non supportato!"); } // aggiunta controllo alla griglia if (ctrl != null) { if (_typeCtrl == TypeTemplateCol.action || _typeCtrl == TypeTemplateCol.action_url || _typeCtrl == TypeTemplateCol.request || _typeCtrl == TypeTemplateCol.tabledel || _typeCtrl == TypeTemplateCol.tablelink) { ctrl.ToolTip = _col_des; } if (xmlDoc.node_bool(_colNode, "show_title")) { ctrl.Attributes.Add("show_title", "true"); } ctrl.Style.Add(HtmlTextWriterStyle.Width, "95%"); if (!notTransparent) { ctrl.Style.Add(HtmlTextWriterStyle.BackgroundColor, "transparent"); } container.Controls.Add(ctrl); } } break; case ListItemType.EditItem: //... break; case ListItemType.Footer: { _iField++; // creazione del controllo WebControl ctrl = null; if (_typeCtrl == TypeTemplateCol.euro) { ctrl = new label(new EventHandler(eurosum_DataBinding)).lbl; } else if (_typeCtrl == TypeTemplateCol.real) { ctrl = new label(new EventHandler(realsum_DataBinding)).lbl; } else { throw new Exception("campo '" + _typeCtrl.ToString() + "' non supportato!"); } // aggiunta controllo alla griglia if (ctrl != null) { ctrl.ToolTip = _col_des; ctrl.Style.Add(HtmlTextWriterStyle.Width, "95%"); ctrl.Style.Add(HtmlTextWriterStyle.BackgroundColor, "transparent"); container.Controls.Add(ctrl); } } break; } }
public GoogleGearsAdvanced() { //Native.Window.alert("alert 1"); CreateStyles(); //Native.Window.alert("alert 2"); var shadow = new div { className = "shadow" }; var toolbar = new div { className = "toolbar" }; var workspace0 = new div { className = "workspace0" }; var workspace = new div { className = "workspace" }; workspace0.appendChild( new div("You can create new postcards by clicking on the background image. You can drag those postcards by their borders. You can use your mouse wheel to zoom in or out, too. All postcards will be saved via webSQL. Doubleclick a postcard to delete it.")); shadow.appendChild(workspace0, workspace, toolbar); //toolbar.innerHTML = "<a href='http://gears.google.com/'>get google gears</a> | <a href='http://jsc.sourceforge.net/'>jsc homepage</a> | <a href='http://zproxy.wordpress.com/'>blog</a>"; //AppendError(workspace0, "loading 1..."); var BackgroundTween = new TweenDataDouble(); BackgroundTween.ValueChanged += delegate { workspace.style.Opacity = BackgroundTween.Value; }; BackgroundTween.Value = 0.5; workspace.onmouseover += delegate { BackgroundTween.Value = 0; }; workspace.onmouseout += delegate { BackgroundTween.Value = 0.5; }; //AppendError(workspace0, "loading 2..."); //var cc = new SQLiteConnection(); //cc.Open(); new { }.With( async delegate { while (true) { await Native.window.async.onframe; // we are logging a lot. idle more for now await Task.Delay(500); var Count = await new xxPostcard().Create().CountAsync(); // let UI know how many we have Native.document.title = new { Count }.ToString(); // chrome style may not show title toolbar.innerText = new { Count }.ToString(); // can we do conditional css here? //toolbar.style.color = "blue"; //await toolbar.async.onclick; //// undo //toolbar.style.color = ""; } } ); new HTML.Images.FromAssets.postcard_alpha().InvokeOnComplete( postcard => new HTML.Images.FromAssets.postcard_alpha_200_unfocus().InvokeOnComplete( postcard200 => { // at this point we have the image and we know how large it is //AppendError(workspace0, "loading 3..."); // X:\jsc.svn\examples\javascript\forms\SQLiteConsoleExperiment\SQLiteConsoleExperiment\ApplicationControl.cs // X:\jsc.svn\examples\javascript\Test\TestSQLiteConnection\TestSQLiteConnection\Application.cs // Cannot read property 'transaction' of null" new xxPostcard().Create(); //catch (System.Exception exc) //{ // var err_msg = exc.Message; // AppendError(workspace0, err_msg); //} //AppendError(workspace0, "loading 4..."); #region Spawn Func<PostcardEntry, Postcard> Spawn = template => { var p2 = new Postcard(postcard, postcard200, workspace); p2.CurrentDrag.Position.X = template.X; p2.CurrentDrag.Position.Y = template.Y; p2.AttachTo(shadow); System.Console.WriteLine("new: " + p2.Id); if (template.Text == null) { template.Text = new[] { "Hello!", "Yo!", "Whuzza!", "Howdy!", "Cheers!" }.Randomize().First() + "\nWrite something here!"; } if (template.Zoom100 == 0) { template.Zoom100 = (int)System.Math.Floor((new System.Random().NextDouble() + 0.5) * 100); } p2.Content.value = template.Text; System.Console.WriteLine("SetZoom: " + new { template.Zoom100 }); p2.SetZoom(template.Zoom100 / 100.0); if (template.Id == null) { try { new xxPostcard().InsertAsync( new xxPostcardRow { Id = p2.Id, Text = p2.Text, Zoom100 = (int)System.Math.Floor(p2.Zoom * 100), X = p2.CurrentDrag.Position.X, Y = p2.CurrentDrag.Position.Y } ); } catch (System.Exception exc) { AppendError(workspace0, exc.Message); } } else { p2.Id = template.Id; } #region RightClick p2.RightClick += delegate { System.Console.WriteLine("dispose: " + p2.Id); p2.Dispose(); //db.execute("delete from Postcards where Id = ?", p2.Id); Console.WriteLine("delete:"); // 21:15078ms delete: view - source:41361 //Uncaught RangeError: Maximum call stack size exceeded ( from x in new xxPostcard() where x.Id == p2.Id select x ).Delete(); //new xPostcard().Where(x => x.Id == p2.Id).Delete(cc); Console.WriteLine("delete: done?"); }; #endregion #region DoubleClick p2.DoubleClick += delegate { System.Console.WriteLine("dispose: " + p2.Id); p2.Dispose(); //db.execute("delete from Postcards where Id = ?", p2.Id); Console.WriteLine("delete:"); ( from x in new xxPostcard() where x.Id == p2.Id select x ).Delete(); //new xPostcard().Where(x => x.Id == p2.Id).Delete(cc); Console.WriteLine("delete: done?"); }; #endregion #region Changed p2.Changed += delegate { System.Console.WriteLine("changed: " + new PostcardEntry { Id = p2.Id, Text = p2.Text, Zoom100 = (int)System.Math.Floor(p2.Zoom * 100), X = p2.CurrentDrag.Position.X, Y = p2.CurrentDrag.Position.Y }.ToString()); Console.WriteLine("delete:"); new xxPostcard().Delete(x => x.Id == p2.Id); new xxPostcard().InsertAsync( new xxPostcardRow { Id = p2.Id, Text = p2.Text, Zoom100 = (int)System.Math.Floor(p2.Zoom * 100), X = p2.CurrentDrag.Position.X, Y = p2.CurrentDrag.Position.Y } ); }; #endregion System.Console.WriteLine("item: " + template.ToString()); p2.ZoomAndMove(); p2.CurrentDrag.DragStart += delegate { p2.AttachTo(shadow); }; return p2; }; #endregion workspace.onclick += delegate (IEvent ev) { Spawn( new PostcardEntry { X = ev.CursorX, Y = ev.CursorY } ); }; #region LoadFromDatabase new { }.With( async delegate { var query = from Data in new xxPostcard() select Data; foreach (var v in await query.AsEnumerableAsync()) { // 13:232ms {{ Text = hey, X = 355.0, Y = 243.0, Zoom100 = 30.0 }} //Console.WriteLine(new { v.Text, v.X, v.Y, v.Zoom100 }); Spawn( new PostcardEntry { Id = v.Id, Text = v.Text, X = (int)v.X, Y = (int)v.Y, Zoom100 = Math.Max(60, (int)v.Zoom100), } ); } } ); #endregion } ) ); Native.Document.body.appendChild(shadow); }