Inheritance: IJavascriptObject
        public bool GetSimpleValue(IJavascriptObject ijsvalue, out object res, Type iTargetType = null)
        {
            res = null;
            CefV8Value value = CefV8_JavascriptObject.Convert(ijsvalue);

            if ((value.IsUndefined) || (value.IsNull))
            {
                return(true);
            }

            if (value.IsString)
            {
                res = ijsvalue.GetStringValue();
                return(true);
            }

            if (value.IsBool)
            {
                res = value.GetBoolValue();
                return(true);
            }

            if (iTargetType.IsUnsigned())
            {
                if (value.IsUInt)
                {
                    res = value.GetUIntValue();
                }
            }
            else
            {
                if (value.IsInt)
                {
                    res = value.GetIntValue();
                }
            }

            if ((res == null) && (value.IsDouble))
            {
                res = value.GetDoubleValue();
            }

            if (res != null)
            {
                if (iTargetType != null)
                {
                    res = Convert.ChangeType(res, iTargetType);
                }

                return(true);
            }

            if (value.IsDate)
            {
                res = value.GetDateValue();
                return(true);
            }

            return(false);
        }
Beispiel #2
0
        public bool CreateBasic(object ifrom, out IJavascriptObject res)
        {
            Func <object, CefV8Value> conv;

            if (!_Converters.TryGetValue(ifrom.GetType(), out conv))
            {
                res = null;
                return(false);
            }

            res = new CefV8_JavascriptObject(_CefV8_WebView.Evaluate(() => conv(ifrom)));
            return(true);
        }
Beispiel #3
0
 private CefV8_JavascriptObject UpdateObject(CefV8_JavascriptObject res, ObjectObservability?objectObservability = null)
 {
     BasicUpdateObject(res.RawValue, objectObservability);
     return(res);
 }
Beispiel #4
0
 private CefV8_JavascriptObject UpdateObject(CefV8_JavascriptObject res, bool?readOnly = null)
 {
     BasicUpdateObject(res.RawValue, readOnly);
     return(res);
 }
Beispiel #5
0
 private CefV8_JavascriptObject UpdateObject(CefV8_JavascriptObject ires)
 {
     BasicUpdateObject(ires.RawValue);
     return(ires);
 }