Exemplo n.º 1
0
 private JSGenericObject(CefV8CompleteContext context, CefV8Value value)
 {
     JSValue = value;
     _MappedJSValue = value;
     CValue = null;
     _CefV8Context = context;
 }
 public CSharpToJavascriptMapper(CefV8CompleteContext context, IJSOLocalBuilder Builder, IJSCBridgeCache icacher)
 {
     _CefV8Context = context;
     _IJSOBuilder = Builder;
     _Cacher = icacher;
     _Basic = new BasicCSharpToJavascriptConverter(_CefV8Context);
 }
Exemplo n.º 3
0
 public static void Bind(this CefV8Value @this, string functionname, CefV8CompleteContext iCefV8Context, Action<string, CefV8Value, CefV8Value[]> iaction)
 {
     iCefV8Context.RunAsync(() =>
         {
             var function = CefV8Value.CreateFunction(functionname, new CefV8Handler_Action(iaction));
             @this.SetValue(functionname, function, CefV8PropertyAttribute.None);
         });
 }
Exemplo n.º 4
0
 public static Task<CefV8Value> InvokeAsync(this CefV8Value @this, string functionname, CefV8CompleteContext context, params CefV8Value[] args)
 {
     
     return context.EvaluateAsync(() =>
         {
             var fn = @this.GetValue(functionname);
             if ((fn==null) || !fn.IsFunction)
                 return CefV8Value.CreateUndefined();
             return fn.ExecuteFunction(@this, args);
         }
         );
 }
        internal JavascriptSessionInjector(CefV8CompleteContext iWebView, IJSOBuilder iGlobalBuilder, IJavascriptListener iJavascriptListener)
        {
            _CefV8Context = iWebView;
            _GlobalBuilder = iGlobalBuilder;
            _IJavascriptListener = iJavascriptListener;


            if (_IJavascriptListener != null)
            {
                _Listener = _GlobalBuilder.CreateJSO();
                _Listener.Bind("TrackChanges",_CefV8Context, (c, o, e) => _IJavascriptListener.OnJavaScriptObjectChanges(e[0], e[1].GetStringValue(), e[2]));
                _Listener.Bind("TrackCollectionChanges", _CefV8Context, (c, o, e) => _IJavascriptListener.OnJavaScriptCollectionChanges(e[0], e[1].GetArrayElements(), e[2].GetArrayElements(), e[3].GetArrayElements()));
            }
            else
                _Listener = _GlobalBuilder.CreateJSO();
        }
Exemplo n.º 6
0
        internal BidirectionalMapper(object iRoot, CefV8CompleteContext iwebview, JavascriptBindingMode iMode, object iadd)
        {
            _V8Context = iwebview;
            _LocalBuilder = new LocalBuilder(iwebview);
            _JSObjectBuilder = new CSharpToJavascriptMapper(iwebview, _LocalBuilder, this);
            _JavascriptToCSharpMapper = new JavascriptToCSharpMapper();
            _Root = _JSObjectBuilder.Map(iRoot, iadd);
            _UnrootedEntities = new List<IJSCSGlue>();
            _BindingMode = iMode;

            IJavascriptListener JavascriptObjecChanges = null;
            if (iMode == JavascriptBindingMode.TwoWay)
                JavascriptObjecChanges = this;

            _GlobalBuilder = new GlobalBuilder(_V8Context, "MVVMGlue");

            _SessionInjector = new JavascriptSessionInjector(iwebview, _GlobalBuilder, JavascriptObjecChanges);
        }
Exemplo n.º 7
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;
        }
Exemplo n.º 8
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;

        }
Exemplo n.º 9
0
 public JSGenericObject(CefV8CompleteContext context, CefV8Value value, object icValue)
 {
     JSValue = value;
     CValue = icValue;
     _CefV8Context = context;
 }
Exemplo n.º 10
0
 internal StringBinding(CefV8CompleteContext context, CefV8Value root, JavascriptSessionInjector iJavascriptSessionInjector)
 {
     _JavascriptSessionInjector = iJavascriptSessionInjector;
     _Context = context;
     _Root = root;
 }
Exemplo n.º 11
0
 public GlobalBuilder(CefV8CompleteContext iWebView, string iNameScape)
 {
     _CefV8Context = iWebView;
     _NameScape = iNameScape;
 }
Exemplo n.º 12
0
 public static CefV8Value Invoke(this CefV8Value @this, string functionname, CefV8CompleteContext iCefV8Context, params CefV8Value[] args)
 {
     return @this.InvokeAsync(functionname, iCefV8Context, args).Result;
 }
Exemplo n.º 13
0
 private HTML_Binding(CefV8CompleteContext iContext, BidirectionalMapper iConvertToJSO)
 {
     _CefV8Context = iContext;
     _BirectionalMapper = iConvertToJSO;
 }
Exemplo n.º 14
0
 public JSResultCommand(CefV8CompleteContext ijsobject, IJSOBuilder builder, IResultCommand icValue)
 {
     _CefV8Context = ijsobject;
     _JSResultCommand = icValue;
     JSValue = builder.CreateJSO();    
 }
Exemplo n.º 15
0
 public LocalBuilder(CefV8CompleteContext iIWebView)
 {
     _CefV8Context = iIWebView;
 }
Exemplo n.º 16
0
 public JSSimpleCommand(CefV8CompleteContext iCefV8Context, IJSOBuilder builder, ISimpleCommand icValue)
 {
     _CefV8Context = iCefV8Context;
     _JSSimpleCommand = icValue;
     JSValue = builder.CreateJSO();    
 }
Exemplo n.º 17
0
 public static JSGenericObject CreateNull(CefV8CompleteContext context, IJSOLocalBuilder builder)
 {
     return new JSGenericObject(context, builder.CreateNull());
 }
Exemplo n.º 18
0
 public TestCefGlueWindow(CefFrame iFrame, CefV8CompleteContext iContext)
 {
     _CefFrame = iFrame;
     _CefV8Context = iContext.Context;
 }