Example #1
0
 public void Dispose()
 {
     _Context.RunAsync(() =>
     {
         if (_JavascriptSessionInjector != null)
         {
             _JavascriptSessionInjector.Dispose();
             _JavascriptSessionInjector = null;
         }
     });
 }
        public void Dispose()
        {
            if (ListenToCSharp)
            {
                UnlistenToCSharpChanges();
            }

            if (_SessionInjector != null)
            {
                _SessionInjector.Dispose();
                _SessionInjector = null;
            }

            _UnrootedEntities.Clear();
        }
        internal BidirectionalMapper(object iRoot, IWebView iwebview, IDispatcher UIDispatcher, JavascriptBindingMode iMode, object iadd)
        {
            _IWebView = iwebview;
            _JSObjectBuilder = new CSharpToJavascriptMapper(iwebview,UIDispatcher, this);
            _Root = _JSObjectBuilder.Map(iRoot, iadd);
            _UnrootedEntities = new List<IJSCSGlue>();
            _BindingMode = iMode;

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


            _SessionInjector = new JavascriptSessionInjector(iwebview, JavascriptObjecChanges);
        }
Example #4
0
        public static async Task<IHTMLBinding> Bind(IHTMLWindow view, string iViewModel)
        {
            var context = view.MainFrame;

            var root = await context.EvaluateAsync(() =>
                {
                    var json = context.GetGlobal().GetValue("JSON");
                    return json.Invoke("parse", context, context.Factory.CreateString(iViewModel));
                });

            var injector = new JavascriptSessionInjector(context, null);
            var mappedroot = injector.Map(root, null);
            await injector.RegisterInSession(mappedroot);

            return new StringBinding(context, mappedroot, injector);
        }
        internal BidirectionalMapper(object iRoot, IWebView iwebview, IDispatcher UIDispatcher, JavascriptBindingMode iMode, object iadd)
        {
            _IWebView         = iwebview;
            _JSObjectBuilder  = new CSharpToJavascriptMapper(iwebview, UIDispatcher, this);
            _Root             = _JSObjectBuilder.Map(iRoot, iadd);
            _UnrootedEntities = new List <IJSCSGlue>();
            _BindingMode      = iMode;

            IJavascriptListener JavascriptObjecChanges = null;

            if (iMode == JavascriptBindingMode.TwoWay)
            {
                JavascriptObjecChanges = this;
            }


            _SessionInjector = new JavascriptSessionInjector(iwebview, JavascriptObjecChanges);
        }
Example #6
0
 internal StringBinding(IWebView context, IJavascriptObject root, JavascriptSessionInjector iJavascriptSessionInjector)
 {
     _JavascriptSessionInjector = iJavascriptSessionInjector;
     _Context = context;
     _Root = root;
 }
        public void Dispose()
        {
            if (ListenToCSharp)
                UnlistenToCSharpChanges();

            if (_SessionInjector != null)
            {
                _SessionInjector.Dispose();
                _SessionInjector = null;
            }

            _UnrootedEntities.Clear();
        }