public CSharpToJavascriptConverter(HTMLViewContext context, IJavascriptSessionCache icacher, IJSCommandFactory commandFactory, IWebSessionLogger logger)
 {
     _CommandFactory = commandFactory;
     _Logger = logger;
     _Context = context;
     _Cacher = icacher;
 }
Example #2
0
 public CSharpToJavascriptConverter(HTMLViewContext context, IJavascriptSessionCache icacher, IJSCommandFactory commandFactory, IWebSessionLogger logger)
 {
     _CommandFactory = commandFactory;
     _Logger         = logger;
     _Context        = context;
     _Cacher         = icacher;
 }
 private HTML_Binding(BidirectionalMapper iConvertToJSO, IWebSessionLogger logger)
 {
     _Context = iConvertToJSO.Context;
     _BirectionalMapper = iConvertToJSO;
     _Logger = logger;           
     _Bindings.Add(this);
     _Logger.Debug(() => $"HTML_Binding {_Current} created");
 }
        protected override void Init()
        {
            _ICSharpMapper = Substitute.For<IJavascriptSessionCache>();
            _JSCommandFactory = Substitute.For<IJSCommandFactory>();
            _ICSharpMapper.GetCached(Arg.Any<object>()).Returns((IJSCSGlue)null);
            _javascriptFrameworkManager = Substitute.For<IJavascriptFrameworkManager>();
            _HTMLViewContext = new HTMLViewContext(_WebView, GetTestUIDispacther(), _javascriptFrameworkManager, null, _Logger);         
            _ConverTOJSO = new CSharpToJavascriptConverter(_HTMLViewContext, _ICSharpMapper, _JSCommandFactory, _Logger);
            _Test = new TestClass { S1 = "string", I1 = 25 };
            _Tests = new List<TestClass>
            {
                new TestClass() {  S1 = "string1", I1 = 1 },
                new TestClass() { S1 = "string2", I1 = 2  }
            };
            _Test2 = new Test2() { T1 = _Test, T2 = _Test };

            _Tests_NG = new ArrayList();
            _Tests_NG.Add(_Tests[0]);
            _Tests_NG.Add(_Tests[0]);
        }
 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); 
 }
Example #6
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;
        }
Example #7
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 StringBinding(HTMLViewContext context, IJavascriptObject root)
 {
     _Context = context;
     _Root = root;
 }
Example #9
0
 public CommandFactory(HTMLViewContext context, IJavascriptToCSharpConverter converter)
 {
     _HTMLViewContext             = context;
     _JavascriptToCSharpConverter = converter;
 }
 public CommandFactory(HTMLViewContext context, IJavascriptToCSharpConverter converter)
 {
     _HTMLViewContext = context;
     _JavascriptToCSharpConverter = converter;
 }
Example #11
0
        internal static IGlueFactory GetFactory(HTMLViewContext context, IJavascriptToCSharpConverter converter)
        {
            var isMapping = context.JavascriptFrameworkIsMappingObject;

            return(isMapping ? (IGlueFactory) new GlueMappingFactory(context, converter) : new GlueFactory(context, converter));
        }