private DateTime?GetDate(Awesomium_Core.JSValue iJSValue) { if (!iJSValue.IsObject) { return(null); } Awesomium_Core.JSObject ob = iJSValue; Awesomium_Core.JSObject extractor = GetExtractor(); if ((bool)extractor.Invoke("isDate", iJSValue) == false) { return(null); } int year = (int)ob.Invoke("getFullYear", null); int month = (int)ob.Invoke("getMonth", null) + 1; int day = (int)ob.Invoke("getDate", null); int hour = (int)ob.Invoke("getHours", null); int minute = (int)ob.Invoke("getMinutes", null); int second = (int)ob.Invoke("getSeconds", null); int millisecond = (int)ob.Invoke("getMilliseconds", null); return(new DateTime(year, month, day, hour, minute, second, millisecond)); }
private DateTime?GetDate(Awesomium_Core.JSValue iJSValue) { if (!iJSValue.IsObject) { return(null); } Awesomium_Core.JSObject ob = iJSValue; if (ob == null) { return(null); } Awesomium_Core.JSObject ko = _IWebView.ExecuteJavascriptWithResult("ko"); if ((bool)ko.Invoke("isDate", iJSValue) == false) { return(null); } int year = (int)ob.Invoke("getFullYear", null); int month = (int)ob.Invoke("getMonth", null) + 1; int day = (int)ob.Invoke("getDate", null); int hour = (int)ob.Invoke("getHours", null); int minute = (int)ob.Invoke("getMinutes", null); int second = (int)ob.Invoke("getSeconds", null); int millisecond = (int)ob.Invoke("getMilliseconds", null); return(new DateTime(year, month, day, hour, minute, second, millisecond)); }
private Awesomium_Core.JSValue Check(Awesomium_Core.JSObject ires) { if (ires == null) { throw ExceptionHelper.NoKoExtension(); } return(ires); }
private Awesomium_Core.JSValue Check(Awesomium_Core.JSObject ires) { if (ires == null) { throw ExceptionHelper.GetUnexpected(); } return(ires); }
private Awesomium_Core.JSObject GetExtractor() { if (_Extractor != null) return _Extractor; _Extractor = _WebView.ExecuteJavascriptWithResult("(function() { return { isDate : function(obj) { return obj instanceof Date; }, isNull : function(obj) { return (obj===null) || (obj instanceof Null_reference); }}; })()"); return _Extractor; }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); RestoreLocation = this.Location; RestoreSize = this.Size; awesomium.OnClose += (ss, ee) => { if (OnCloseButtonClick != null) { this.OnCloseButtonClick(ss, ee); } }; awesomium.OnMax += (ss, ee) => { if (this.WindowState != FormWindowState.Maximized) { if (this.Size != this.MaximumSize) { RestoreLocation = this.Location; RestoreSize = this.Size; Screen s = Screen.FromControl(this); this.Size = new Size(s.Bounds.Width, s.Bounds.Height); this.WindowState = FormWindowState.Maximized; } } else { // restore location and size of the form on the desktop this.DesktopBounds = new Rectangle(RestoreLocation, RestoreSize); // restore form's window state this.WindowState = FormWindowState.Normal; } }; awesomium.OnMin += (ss, ee) => { this.Invoke(new MethodInvoker(() => { RestoreLocation = this.Location; RestoreSize = this.Size; this.WindowState = FormWindowState.Minimized; })); }; _jsObject = awesomium.WebBrowser.CreateGlobalJavascriptObject("ScriptInterface"); // setup some javascript callbacks _jsObject.Bind("call", false, OnJsCall); if (UseLocalHtml) { string assemblyPath = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location); string url = assemblyPath + Path.DirectorySeparatorChar + ".appui/" + this.GetType().Name.ToLower() + ".html"; if (File.Exists(url)) { awesomium.WebBrowser.Source = new Uri(url); } } }
private Awesomium_Core.JSObject GetExtractor() { if (_Extractor != null) { return(_Extractor); } _Extractor = _WebView.ExecuteJavascriptWithResult("(function() { return { isDate : function(obj) { return obj instanceof Date; }, isNull : function(obj) { return (obj===null) || (obj instanceof Null_reference); }}; })()"); return(_Extractor); }
public IJavascriptObject CreateObject(bool iLocal) { string Name = string.Format("MVVM_HTML_{0}", _Count); return(_IWebView.EvaluateSafe(() => { Awesomium_Core.JSObject res = (iLocal) ? new Awesomium_Core.JSObject() : (Awesomium_Core.JSObject)_IWebView.CreateGlobalJavascriptObject(Name); res["_MappedId"] = new Awesomium_Core.JSValue(_Count++); return res.Convert(); })); }
private IJavascriptObject CreateJSObject(bool local) { string Name = string.Format("MVVM_HTML_{0}", _Count); return(_IWebView.EvaluateSafe(() => { Awesomium_Core.JSObject res = (local) ? new Awesomium_Core.JSObject() : (Awesomium_Core.JSObject)_IWebView.CreateGlobalJavascriptObject(Name); res[NeutroniumConstants.ObjectId] = new Awesomium_Core.JSValue(_Count++); return res.Convert(); })); }
public static Awesomium.Core.JSObject ReadFromFile(string name) { Awesomium.Core.JSObject returnObj = new Awesomium.Core.JSObject(); try { string content = File.ReadAllText(name); returnObj["status"] = true; returnObj["text"] = content; } catch { returnObj["status"] = false; } return(returnObj); }
private Awesomium_Core.JSValue UpdateObject(Awesomium_Core.JSObject ires) { ires["_MappedId"] = new Awesomium_Core.JSValue(_Count++); return(ires); }
private Awesomium_Core.JSValue UpdateObject(Awesomium_Core.JSObject ires) { ires[NeutroniumConstants.ObjectId] = new Awesomium_Core.JSValue(_Count++); return(ires); }