Пример #1
0
        public JSArray(CefV8CompleteContext context, IEnumerable<IJSCSGlue> values, IEnumerable collection, Type ElementType)
        {
            var dest = values.Select(v => v.JSValue).ToList();
            _CefV8Context = context;

            var res = _CefV8Context.Evaluate(() =>
            {
                CefV8Value myres = CefV8Value.CreateArray(dest.Count);
                dest.ForEach((el, i) => myres.SetValue(i, el));
                return myres;
            });

            JSValue = res;

            Items = new List<IJSCSGlue>(values);
            CValue = collection;
            IndividualType = ElementType;
        }
Пример #2
0
        public JSCommand(CefV8CompleteContext iCefV8Context, IJSOBuilder builder, ICommand icValue)
        {
            _CefV8Context = iCefV8Context;
            _Command = icValue;
       
            bool canexecute = true;
            try
            {
                canexecute = _Command.CanExecute(null);
            }
            catch { }

            JSValue = _CefV8Context.Evaluate(() =>
                {
                    //_CefV8Context.Enter();
                    CefV8Value res = builder.CreateJSO();
                    res.SetValue("CanExecuteValue", CefV8Value.CreateBool(canexecute),CefV8PropertyAttribute.None);
                    res.SetValue("CanExecuteCount", CefV8Value.CreateInt(_Count), CefV8PropertyAttribute.None); 
                    //_CefV8Context.Exit();
                    return res;       
                });
            //.Result;

        }