public void show_doc(doc d, object for_scripting = null) { try { StringBuilder title = !string.IsNullOrEmpty(d.title) ? new StringBuilder($@"<html xml:lang='en-us' xmlns='http://www.w3.org/1999/xhtml'><head> <meta charset='utf-8'> <meta http-equiv='X-UA-Compatible' content='IE=edge'> <meta name='viewport' content='width=device-width, initial-scale=1'> <style> body {{ font-family:segoe ui light; font-size:11pt; background-color:{(d.back_color != "" ? d.back_color : "white")}; padding:0px; margin:0px; border:0px; }} </style> </head> <body> {(!string.IsNullOrEmpty(d.title) ? $"<h3 style='{(!string.IsNullOrEmpty(d.color_title) ? $"color:{d.color_title};padding:0px;margin:0px;" : "")}'>{d.title}</h3>" : "")} {(!string.IsNullOrEmpty(d.sub_title) ? $"<p style='padding:0px;margin:0px;margin-top:5px;{(!string.IsNullOrEmpty(d.style_sub_title) ? $"{d.style_sub_title};" : "")}{(!string.IsNullOrEmpty(d.color_sub_title) ? $"color:{d.color_sub_title};" : "")}'>{d.sub_title}</p>" : "")} </body></html>") : null; StringBuilder html = new StringBuilder($@"<html xml:lang='en-us' xmlns='http://www.w3.org/1999/xhtml'><head> <meta charset='utf-8'> <meta http-equiv='X-UA-Compatible' content='IE=edge'> <meta name='viewport' content='width=device-width, initial-scale=1'> <style> body {{ font-family:segoe ui light; font-size:11pt; background-color:{(d.back_color != "" ? d.back_color : "white")}; padding:0px; margin:0px; border:0px; }} {d.style} </style> {(!string.IsNullOrEmpty(d.script) ? $@"<script language=javascript> {d.script}</script>" : "")} </head> <body {(d.scroll_to_down ? "onload='window.scrollTo(0,document.body.scrollHeight);'" : "")}>"); foreach (doc_element e in d.elements) { if (e is section) { html.Append(((section)e).html); } } html.Append("</body></html>"); if (d.back_color != "") { this.BackColor = Color.FromName(d.back_color); } show_html(title != null ? title.ToString() : "", html.ToString(), for_scripting); } catch { } }
public cfg() { // ciclo sui documenti config.xml specificati e memorizzo le key, web_service, conn_string foreach (string cfg_path in key("configs").Split(new char[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries)) { string path = System.IO.Path.Combine(base_path, cfg_path); if (System.IO.File.Exists(path)) { doc xml = new doc(path); foreach (key k in xml.keys) { if (!_keys.ContainsKey(k.name.ToLower())) { _keys.Add(k.name.ToLower(), k); } else if (k.level.has_priority(_keys[k.name.ToLower()].level)) { _keys[k.name.ToLower()] = k; } } foreach (ws w in xml.wss) { if (!_wss.ContainsKey(w.name.ToLower())) { _wss.Add(w.name.ToLower(), w); } else if (w.level.has_priority(_wss[w.name.ToLower()].level)) { _wss[w.name.ToLower()] = w; } } foreach (conn c in xml.conns) { if (!_conns.ContainsKey(c.name.ToLower())) { _conns.Add(c.name.ToLower(), c); } else if (c.level.has_priority(_conns[c.name.ToLower()].level)) { _conns[c.name.ToLower()] = c; } } } } }
protected static void pre_show(EventHandler ev_data = null, object tag = null, EventHandler ev_button = null, string btn_text = "" , int?width = null, int?height = null, object tag2 = null, doc d = null, object for_scripting = null) { _tag = tag; _tag2 = tag2; _ev_data = ev_data; _ev_button = ev_button; _btn_text = btn_text; _width = width; _height = height; _for_scripting = for_scripting; _d = d; }