Inheritance: IJavascriptSessionCache
Beispiel #1
0
        internal BidirectionalMapper(object root, HtmlViewEngine contextBuilder, IGlueFactory glueFactory,
                                     IJavascriptObjectBuilderStrategyFactory strategyFactory, JavascriptBindingMode mode, IWebSessionLogger logger)
        {
            _BuilderStrategyFactory = strategyFactory ?? new StandardStrategyFactory();
            Mode    = mode;
            _Logger = logger;
            var javascriptObjecChanges = (mode == JavascriptBindingMode.TwoWay) ? (IJavascriptChangesObserver)this : null;

            Context           = contextBuilder.GetMainContext(javascriptObjecChanges);
            _SessionCache     = new SessionCacher();
            _ListenerRegister = ListenToCSharp ? new FullListenerRegister(OnCSharpPropertyChanged, OnCSharpCollectionChanged): null;
            glueFactory       = glueFactory ?? GlueFactoryFactory.GetFactory(Context, _SessionCache, this, _ListenerRegister?.On);
            _JsObjectBuilder  = new CSharpToJavascriptConverter(_SessionCache, glueFactory, _Logger);
            _RootObject       = root;
        }
Beispiel #2
0
        internal BidirectionalMapper(object iRoot, HTMLViewEngine contextBuilder, JavascriptBindingMode iMode, IWebSessionLogger logger)
        {
            _BindingMode = iMode;
            _Logger      = logger;
            var javascriptObjecChanges = (iMode == JavascriptBindingMode.TwoWay) ? (IJavascriptChangesObserver)this : null;

            _Context                        = contextBuilder.GetMainContext(javascriptObjecChanges);
            _SessionCache                   = new SessionCacher();
            _ListenerRegister               = new FullListenerRegister(
                (n) => n.PropertyChanged   += CSharpPropertyChanged,
                (n) => n.PropertyChanged   -= CSharpPropertyChanged,
                (n) => n.CollectionChanged += CSharpCollectionChanged,
                (n) => n.CollectionChanged -= CSharpCollectionChanged,
                (c) => c.ListenChanges(),
                (c) => c.UnListenChanges());
            var commandFactory = new CommandFactory(_Context, this);

            _JSObjectBuilder = new CSharpToJavascriptConverter(contextBuilder.HTMLWindow, _SessionCache, commandFactory, _Logger);
            _RootObject      = iRoot;
        }
 internal BidirectionalMapper(object iRoot, HTMLViewEngine contextBuilder, JavascriptBindingMode iMode, object addicionalObject, IWebSessionLogger logger)
 {        
     _BindingMode = iMode;
     _Logger = logger;
     var javascriptObjecChanges = (iMode == JavascriptBindingMode.TwoWay) ? (IJavascriptChangesObserver)this : null;
     _Context = contextBuilder.GetMainContext(javascriptObjecChanges);
     _sessionInjector = _Context.JavascriptSessionInjector;  
     _SessionCache = new SessionCacher();
     _ListenerRegister = new FullListenerRegister(
                                 (n) => n.PropertyChanged += CSharpPropertyChanged,
                                 (n) => n.PropertyChanged -= CSharpPropertyChanged,
                                 (n) => n.CollectionChanged += CSharpCollectionChanged,
                                 (n) => n.CollectionChanged -= CSharpCollectionChanged,
                                 (c) => c.ListenChanges(),
                                 (c) => c.UnListenChanges());
     var commandFactory = new CommandFactory(_Context, this);
     RegisterJavascriptHelper();
     _JSObjectBuilder = new CSharpToJavascriptConverter(_Context, _SessionCache, commandFactory, _Logger) ;
     _Root = _JSObjectBuilder.Map(iRoot, addicionalObject); 
 }
Beispiel #4
0
        internal BidirectionalMapper(object root, HTMLViewEngine contextBuilder, IGlueFactory glueFactory,
                                     IJavascriptObjectBuilderStrategyFactory strategyFactory, JavascriptBindingMode mode, IWebSessionLogger logger)
        {
            _BuilderStrategyFactory = strategyFactory ?? new StandardStrategyFactory();
            _BindingMode            = mode;
            _Logger = logger;
            var javascriptObjecChanges = (mode == JavascriptBindingMode.TwoWay) ? (IJavascriptChangesObserver)this : null;

            _Context                        = contextBuilder.GetMainContext(javascriptObjecChanges);
            _SessionCache                   = new SessionCacher();
            _ListenerRegister               = new FullListenerRegister(
                (n) => n.PropertyChanged   += CSharpPropertyChanged,
                (n) => n.PropertyChanged   -= CSharpPropertyChanged,
                (n) => n.CollectionChanged += CSharpCollectionChanged,
                (n) => n.CollectionChanged -= CSharpCollectionChanged,
                (c) => c.ListenChanges(),
                (c) => c.UnListenChanges());
            glueFactory      = glueFactory ?? GlueFactoryFactory.GetFactory(_Context, this);
            _JSObjectBuilder = new CSharpToJavascriptConverter(contextBuilder.HTMLWindow, _SessionCache, glueFactory, _Logger);
            _RootObject      = root;
        }
        internal BidirectionalMapper(object root, HtmlViewEngine contextBuilder, IGlueFactory glueFactory,
                                     IJavascriptObjectBuilderStrategyFactory strategyFactory, JavascriptBindingMode mode, IWebSessionLogger logger)
        {
            _BuilderStrategyFactory = strategyFactory ?? new StandardStrategyFactory();
            Mode    = mode;
            _Logger = logger;
            var javascriptObjectChanges = (mode == JavascriptBindingMode.TwoWay) ? (IJavascriptChangesObserver)this : null;

            Context       = contextBuilder.GetMainContext(javascriptObjectChanges);
            _SessionCache = new SessionCacher();
            var jsUpdateHelper = new JsUpdateHelper(this, Context, () => _BuilderStrategy, _SessionCache);

            _ListenerUpdater = ListenToCSharp ? new ListenerUpdater(jsUpdateHelper) : null;
            glueFactory      = glueFactory ?? GlueFactoryFactory.GetFactory(Context, _SessionCache, this, _ListenerUpdater?.On);
            _JsObjectBuilder = new CSharpToJavascriptConverter(_SessionCache, glueFactory, _Logger);
            jsUpdateHelper.JsObjectBuilder = _JsObjectBuilder;
            _JsUpdateHelper = jsUpdateHelper;
            _RootObject     = root;

            _JsUpdateHelper.CheckUiContext();
            JsValueRoot = _JsObjectBuilder.Map(_RootObject);
            JsValueRoot.AddRef();
        }