public IJavascriptObject CreateNull()
        {
            if (_JSNull == null)
            {
                _JSNull = Check(_IWebView.EvaluateSafe(() => _IWebView.ExecuteJavascriptWithResult("new Null_reference()"))).Convert();
            }

            return(_JSNull);
        }
Example #2
0
        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.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);
        }
Example #4
0
        private async void btnCheckIpAddress_Click(object sender, RoutedEventArgs e)
        {
            // browser = new Awesomium.Windows.Controls.WebControl();
            btnCheckIpAddress.IsEnabled = false;

            using (Awesomium.Core.IWebView tempView = WebCore.CreateWebView(0, 0))
            {
                await tempView.WaitPageLoadComplete(() => { tempView.Source = "api.ipify.org".ToUri(); });

                string ipAddress = tempView.ExecuteJavascriptWithResult("document.body.textContent");
                MessageBox.Show(string.Format("Reported IP Address [ipify.org]: {0}", ipAddress));
            }
            btnCheckIpAddress.IsEnabled = true;
        }
 public IJavascriptObject GetGlobal()
 {
     return(_IWebView.ExecuteJavascriptWithResult("window").Convert());
 }