Ejemplo n.º 1
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;
        }
Ejemplo n.º 2
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;
        }
Ejemplo n.º 3
0
 internal BidirectionalMapper(object root, HTMLViewEngine contextBuilder, JavascriptBindingMode mode, IWebSessionLogger logger, IJavascriptObjectBuilderStrategyFactory strategyFactory) :
     this(root, contextBuilder, null, strategyFactory, mode, logger)
 {
 }