internal BidirectionalMapper(object root, HtmlViewEngine contextBuilder, IGlueFactory glueFactory, IJavascriptObjectBuilderStrategyFactory strategyFactory, JavascriptBindingMode mode, IInternalSessionCache sessionCacher) { Mode = mode; Context = contextBuilder.GetMainContext(); _SessionCache = sessionCacher ?? new SessionCacher(); strategyFactory = strategyFactory ?? new StandardStrategyFactory(); _BuilderStrategy = new Lazy <IJavascriptObjectBuilderStrategy>(() => strategyFactory.GetStrategy(Context.WebView, _SessionCache, Context.JavascriptFrameworkIsMappingObject) ); _JavascriptFrameworkManager = new Lazy <IJavascriptFrameworkMapper>(() => Context.GetMapper(_SessionCache, BuilderStrategy)); var jsUpdateHelper = new JsUpdateHelper(this, Context, _JavascriptFrameworkManager, _SessionCache); _JavascriptToGlueMapper = new JavascriptToGlueMapper(jsUpdateHelper, _SessionCache); _CSharpChangesListener = ListenToCSharp ? new CSharpListenerJavascriptUpdater(jsUpdateHelper) : null; glueFactory = glueFactory ?? GlueFactoryFactory.GetFactory(Context, _SessionCache, _JavascriptToGlueMapper, _CSharpChangesListener?.On); _CSharpToGlueMapper = new CSharpToGlueMapper(_SessionCache, glueFactory, Context.Logger); jsUpdateHelper.GlueMapper = _CSharpToGlueMapper; _CSharpUnrootedObjectManager = new CSharpUnrootedObjectManager(jsUpdateHelper, _CSharpToGlueMapper); glueFactory.UnrootedObjectManager = _CSharpUnrootedObjectManager; _JavascriptChangesListener = (Mode == JavascriptBindingMode.TwoWay) ? new JavascriptListenerCSharpUpdater(_CSharpChangesListener, jsUpdateHelper, _JavascriptToGlueMapper) : null; jsUpdateHelper.CheckUiContext(); JsValueRoot = _CSharpToGlueMapper.Map(root); JsValueRoot.AddRef(); }
public JavascriptListenerCSharpUpdater(ICSharpChangesListener cSharpChangesListener, IJsUpdateHelper jsUpdateHelper, IJavascriptToGlueMapper javascriptToGlueMapper) { _CSharpChangesListener = cSharpChangesListener; _JsUpdateHelper = jsUpdateHelper; _JavascriptToGlueMapper = javascriptToGlueMapper; }