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]);
        }
 private JsGenericObject(HTMLViewContext context, IJavascriptObject value)
 {
     JSValue = value;
     _MappedJSValue = value;
     CValue = null;
     _HTMLViewContext = context;
 }
示例#3
0
 private JsGenericObject(HTMLViewContext context, IJavascriptObject value)
 {
     JSValue          = value;
     _MappedJSValue   = value;
     CValue           = null;
     _HTMLViewContext = context;
 }
示例#4
0
 public JSArray(HTMLViewContext context, IEnumerable<IJSCSGlue> values, IEnumerable collection)
 {
     _HTMLViewContext = context;
     CValue = collection;
     Items = new List<IJSCSGlue>(values);
     var type = collection.GetElementType();
     _IndividualType = WebView.Factory.IsTypeBasic(type) ?  type : null;
 }
示例#5
0
 private HTML_Binding(BidirectionalMapper iConvertToJSO, IWebSessionLogger logger)
 {
     _Context           = iConvertToJSO.Context;
     _BirectionalMapper = iConvertToJSO;
     _Logger            = logger;
     _Bindings.Add(this);
     _Logger.Debug(() => $"HTML_Binding {_Current} created");
 }
示例#6
0
        public JSArray(HTMLViewContext context, IEnumerable <IJSCSGlue> values, IEnumerable collection)
        {
            _HTMLViewContext = context;
            CValue           = collection;
            Items            = new List <IJSCSGlue>(values);
            var type = collection.GetElementType();

            _IndividualType = WebView.Factory.IsTypeBasic(type) ?  type : null;
        }
示例#7
0
        public JSArray(HTMLViewContext context, IEnumerable<IJSCSGlue> values, IEnumerable collection)
        {
            _HTMLViewContext = context;
            CValue = collection;
            Items = new List<IJSCSGlue>(values);

            var dest = values.Select(v => v.JSValue).ToList();    
            JSValue = WebView.Evaluate(() => WebView.Factory.CreateArray(dest));
            var type = collection.GetElementType();
            _IndividualType = WebView.Factory.IsTypeBasic(type) ?  type : null;
        }
示例#8
0
        public JSCommand(HTMLViewContext context, IJavascriptToCSharpConverter converter, ICommand command)
        {
            _JavascriptToCSharpConverter = converter;
            _HTMLViewContext             = context;
            _Command = command;

            try
            {
                _InitialCanExecute = _Command.CanExecute(null);
            }
            catch { }
        }
  public JSCommand(HTMLViewContext context, IJavascriptToCSharpConverter converter, ICommand command)
  {
      _JavascriptToCSharpConverter = converter;
      _HTMLViewContext = context;
      _Command = command;
 
      try
      {
          _InitialCanExecute = _Command.CanExecute(null);
      }
      catch { }
  }
示例#10
0
        public JSArray(HTMLViewContext context, IEnumerable <IJSCSGlue> values, IEnumerable collection)
        {
            _HTMLViewContext = context;
            CValue           = collection;
            Items            = new List <IJSCSGlue>(values);

            var dest = values.Select(v => v.JSValue).ToList();

            JSValue = WebView.Evaluate(() => WebView.Factory.CreateArray(dest));
            var type = collection.GetElementType();

            _IndividualType = WebView.Factory.IsTypeBasic(type) ?  type : null;
        }
        protected override void Init()
        {
            _ICSharpMapper = Substitute.For <IJavascriptSessionCache>();
            _GlueFactory   = new GlueFactory(null, null);
            _ICSharpMapper.GetCached(Arg.Any <object>()).Returns((IJSCSGlue)null);
            _javascriptFrameworkManager = Substitute.For <IJavascriptFrameworkManager>();
            _HTMLViewContext            = new HTMLViewContext(WebBrowserWindow, GetTestUIDispacther(), _javascriptFrameworkManager, null, _Logger);
            _ConverTOJSO = new CSharpToJavascriptConverter(WebBrowserWindow, _ICSharpMapper, _GlueFactory, _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]);

            _CircularSimple           = new Circular1();
            _CircularSimple.Reference = _CircularSimple;

            _CircularComplex = new Circular2();
            var circularChild = new Circular2
            {
                Reference = _CircularComplex
            };

            _CircularComplex.List.Add(circularChild);
        }
示例#12
0
        public JSCommand(HTMLViewContext context, IJavascriptToCSharpConverter converter, ICommand command)
        {
            _JavascriptToCSharpConverter = converter;
            _HTMLViewContext = context;
            _Command = command;
       
            var canexecute = true;
            try
            {
                canexecute = _Command.CanExecute(null);
            }
            catch { }

            JSValue = WebView.Evaluate(() =>
                {
                    var res = WebView.Factory.CreateObject(true);
                    res.SetValue("CanExecuteValue", WebView.Factory.CreateBool(canexecute));
                    res.SetValue("CanExecuteCount", WebView.Factory.CreateInt(_Count)); 
                    return res;       
                });
        }
示例#13
0
        public JSCommand(HTMLViewContext context, IJavascriptToCSharpConverter converter, ICommand command)
        {
            _JavascriptToCSharpConverter = converter;
            _HTMLViewContext             = context;
            _Command = command;

            var canexecute = true;

            try
            {
                canexecute = _Command.CanExecute(null);
            }
            catch { }

            JSValue = WebView.Evaluate(() =>
            {
                var res = WebView.Factory.CreateObject(true);
                res.SetValue("CanExecuteValue", WebView.Factory.CreateBool(canexecute));
                res.SetValue("CanExecuteCount", WebView.Factory.CreateInt(_Count));
                return(res);
            });
        }
示例#14
0
 public static JsGenericObject CreateNull(HTMLViewContext context)
 {
     return(new JsGenericObject(context, context.WebView.Factory.CreateNull()));
 }
示例#15
0
 internal StringBinding(HTMLViewContext context, IJavascriptObject root)
 {
     _Context = context;
     _Root    = root;
 }
示例#16
0
 public JsSimpleCommand(HTMLViewContext context, IJavascriptToCSharpConverter converter, ISimpleCommand simpleCommand)
 {
     _HTMLViewContext             = context;
     _JavascriptToCSharpConverter = converter;
     _JSSimpleCommand             = simpleCommand;
 }
示例#17
0
 public JsResultCommand(HTMLViewContext context, IJavascriptToCSharpConverter converter, IResultCommand resultCommand)
 {
     _HTMLViewContext             = context;
     _JavascriptToCSharpConverter = converter;
     _JSResultCommand             = resultCommand;
 }
 public JsMappableSimpleCommand(HTMLViewContext context, IJavascriptToCSharpConverter converter, ISimpleCommand resultCommand)
     : base(context, converter, resultCommand)
 {
 }
示例#19
0
 public JsGenericObject(HTMLViewContext context, object icValue)
 {
     CValue           = icValue;
     _HTMLViewContext = context;
 }
示例#20
0
 public GlueFactory(HTMLViewContext context, IJavascriptToCSharpConverter converter)
 {
     _HTMLViewContext             = context;
     _JavascriptToCSharpConverter = converter;
 }
 public JsGenericObject(HTMLViewContext context, IJavascriptObject value, object icValue)
 {
     JSValue = value;
     CValue = icValue;
     _HTMLViewContext = context;
 }
 public static JsGenericObject CreateNull(HTMLViewContext context)
 {
     return new JsGenericObject(context, context.WebView.Factory.CreateNull());
 }
示例#23
0
 public JSMappableCommand(HTMLViewContext context, IJavascriptToCSharpConverter converter, ICommand command) :
     base(context, converter, command)
 {
 }
 public JsResultCommand(HTMLViewContext context, IJavascriptToCSharpConverter converter, IResultCommand resultCommand)
 {
     _HTMLViewContext = context;
     _JavascriptToCSharpConverter = converter;
     _JSResultCommand = resultCommand;          
 }
 public JsSimpleCommand(HTMLViewContext context, IJavascriptToCSharpConverter converter, ISimpleCommand simpleCommand)
 {
     _HTMLViewContext = context;
     _JavascriptToCSharpConverter = converter;
     _JSSimpleCommand = simpleCommand;
 }
示例#26
0
 public JsGenericObject(HTMLViewContext context, IJavascriptObject value, object icValue)
 {
     JSValue          = value;
     CValue           = icValue;
     _HTMLViewContext = context;
 }