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();
        }
Ejemplo n.º 2
0
        public JSCommand(IJSOBuilder builder,  ICommand  icValue)
        {
            _Command = icValue;
       
            bool canexecute = true;
            try
            {
                canexecute = _Command.CanExecute(null);
            }
            catch { }
 
            JSObject res =  builder.CreateJSO();
            res["CanExecuteValue"] = new JSValue(canexecute);
            res["CanExecuteCount"] = new JSValue(_Count);
            JSValue = res;       
        }
        internal JavascriptSessionInjector(IWebView iWebView, IJSOBuilder iGlobalBuilder, IJavascriptListener iJavascriptListener)
        {
            _IWebView = iWebView;
            _GlobalBuilder = iGlobalBuilder;
            _IJavascriptListener = iJavascriptListener;


            if (_IJavascriptListener != null)
            {
                _Listener = _GlobalBuilder.CreateJSO();
                _Listener.Bind("TrackChanges", false, (o, e) => _IJavascriptListener.OnJavaScriptObjectChanges((JSObject)e.Arguments[0], (string)e.Arguments[1], e.Arguments[2]));
                _Listener.Bind("TrackCollectionChanges", false, (o, e) => _IJavascriptListener.OnJavaScriptCollectionChanges((JSObject)e.Arguments[0], (JSValue[])e.Arguments[1], (JSValue[])e.Arguments[2], (JSValue[])e.Arguments[3]));
           }
            else
                _Listener = new JSObject();
        }
        internal JavascriptSessionInjector(IWebView iWebView, IJSOBuilder iGlobalBuilder, IJavascriptListener iJavascriptListener)
        {
            _IWebView            = iWebView;
            _GlobalBuilder       = iGlobalBuilder;
            _IJavascriptListener = iJavascriptListener;


            if (_IJavascriptListener != null)
            {
                _Listener = _GlobalBuilder.CreateJSO();
                _Listener.Bind("TrackChanges", false, (o, e) => _IJavascriptListener.OnJavaScriptObjectChanges((JSObject)e.Arguments[0], (string)e.Arguments[1], e.Arguments[2]));
                _Listener.Bind("TrackCollectionChanges", false, (o, e) => _IJavascriptListener.OnJavaScriptCollectionChanges((JSObject)e.Arguments[0], (JSValue[])e.Arguments[1], (JSValue[])e.Arguments[2], (JSValue[])e.Arguments[3]));
            }
            else
            {
                _Listener = new JSObject();
            }
        }
Ejemplo n.º 5
0
        public JSCommand(IJSOBuilder builder, ICommand icValue)
        {
            _Command = icValue;

            bool canexecute = true;

            try
            {
                canexecute = _Command.CanExecute(null);
            }
            catch { }

            JSObject res = builder.CreateJSO();

            res["CanExecuteValue"] = new JSValue(canexecute);
            res["CanExecuteCount"] = new JSValue(_Count);
            JSValue = res;
        }
Ejemplo n.º 6
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;

        }
Ejemplo n.º 7
0
 public JSResultCommand(CefV8CompleteContext ijsobject, IJSOBuilder builder, IResultCommand icValue)
 {
     _CefV8Context = ijsobject;
     _JSResultCommand = icValue;
     JSValue = builder.CreateJSO();    
 }
Ejemplo n.º 8
0
 public JSSimpleCommand(IJSOBuilder builder, ISimpleCommand icValue)
 {
     _JSSimpleCommand = icValue;
     JSValue          = builder.CreateJSO();
 }
        private JSObject GetMapper(IJavascriptMapper iMapperListener)
        {
            _IJavascriptMapper.Enqueue(iMapperListener);

            if (_Mapper != null)
            {
                return(_Mapper);
            }

            _Mapper = _GlobalBuilder.CreateJSO();

            _Mapper.Bind("Register", false, (o, e) =>
            {
                if (_PullNextMapper)
                {
                    _Current        = _IJavascriptMapper.Dequeue();
                    _PullNextMapper = false;
                }

                if (_Current == null)
                {
                    return;
                }

                int count           = e.Arguments.Length;
                JSObject registered = (JSObject)e.Arguments[0];

                switch (count)
                {
                case 1:
                    _Current.RegisterFirst(registered);
                    break;

                case 3:
                    _Current.RegisterMapping((JSObject)e.Arguments[1], (string)e.Arguments[2], registered);
                    break;

                case 4:
                    _Current.RegisterCollectionMapping((JSObject)e.Arguments[1],
                                                       (string)e.Arguments[2], (int)e.Arguments[3], registered);
                    break;
                }
            });

            _Mapper.Bind("End", false, (o, e) =>
            {
                if (_PullNextMapper)
                {
                    _Current = _IJavascriptMapper.Dequeue();
                }

                if (_Current != null)
                {
                    _Current.End((JSObject)e.Arguments[0]);
                }
                _Current        = null;
                _PullNextMapper = true;
            });

            return(_Mapper);
        }
Ejemplo n.º 10
0
 public JSSimpleCommand(IJSOBuilder builder, ISimpleCommand icValue)
 {
     _JSSimpleCommand = icValue;
     JSValue = builder.CreateJSO();    
 }
Ejemplo n.º 11
0
 public JSSimpleCommand(CefV8CompleteContext iCefV8Context, IJSOBuilder builder, ISimpleCommand icValue)
 {
     _CefV8Context = iCefV8Context;
     _JSSimpleCommand = icValue;
     JSValue = builder.CreateJSO();    
 }
 public JSResultCommand(IJSOBuilder builder, IResultCommand icValue)
 {
     _JSResultCommand = icValue;
     JSValue          = builder.CreateJSO();
 }
Ejemplo n.º 13
0
 public JSResultCommand(IJSOBuilder builder, IResultCommand icValue)
 {
     _JSResultCommand = icValue;
     JSValue = builder.CreateJSO();    
 }