示例#1
0
        internal async Task UpdateJavascriptObjects(bool debugMode)
        {
            await RunInJavascriptContext(async() =>
            {
                RegisterJavascriptHelper();

                Context.InitOnJsContext(debugMode);
                _SessionInjector = Context.JavascriptSessionInjector;

                _BuilderStrategy = _BuilderStrategyFactory.GetStrategy(Context.WebView, _SessionCache, Context.JavascriptFrameworkIsMappingObject);
                _BuilderStrategy.UpdateJavascriptValue(JsValueRoot);

                IJavascriptObject res;
                if (Context.JavascriptFrameworkIsMappingObject)
                {
                    res = await InjectInHtmlSession(JsValueRoot);
                }
                else
                {
                    res = JsValueRoot.JsValue;
                }

                await _SessionInjector.RegisterMainViewModel(res);

                _IsLoaded = true;
            });
        }
 internal JavascriptFrameworkRealMapper(HtmlViewContext context, IJavascriptSessionInjector sessionInjector, IInternalSessionCache sessionCache, IJavascriptObjectBuilderStrategy builderStrategy)
 {
     _SessionInjector = sessionInjector;
     _SessionCache    = sessionCache;
     _BuilderStrategy = builderStrategy;
     _Context         = context;
 }
示例#3
0
 private void InitOnJavascriptContext(bool debugMode)
 {
     RegisterJavascriptHelper();
     Context.InitOnJsContext(debugMode);
     _SessionInjector = Context.JavascriptSessionInjector;
     _BuilderStrategy = _BuilderStrategyFactory.GetStrategy(Context.WebView, _SessionCache, Context.JavascriptFrameworkIsMappingObject);
     _BuilderStrategy.UpdateJavascriptValue(JsValueRoot);
 }
示例#4
0
        internal static IJavascriptFrameworkMapper GetMapper(this HtmlViewContext context, IInternalSessionCache sessionCache, IJavascriptObjectBuilderStrategy builderStrategy)
        {
            var mapping = context.JavascriptFrameworkIsMappingObject;

            return(mapping
                ? (IJavascriptFrameworkMapper) new JavascriptFrameworkRealMapper(context, context.JavascriptSessionInjector, sessionCache, builderStrategy)
                : new JavascriptFrameworkNoMapper(context, sessionCache, builderStrategy));
        }
 internal JavascriptFrameworkNoMapper(HtmlViewContext context, ISessionCache sessionCache, IJavascriptObjectBuilderStrategy builderStrategy)
 {
     _Context         = context;
     _SessionCache    = sessionCache;
     _BuilderStrategy = builderStrategy;
 }
 public JavascriptObjectMixtBuilderStrategy(IWebView webView, IJavascriptSessionCache cache, bool mapping)
 {
     _SynchroneousStrategy = new JavascriptObjectSynchroneousBuilderStrategy(webView, cache, mapping);
     _BulkStrategy         = new JavascriptObjectBulkBuilderStrategy(webView, cache, mapping);
 }