private async Task Update_from_int(int value, IJavascriptObjectBuilderStrategyFactory strategyFactory)
        {
            var root = new IntViewModel();
            var test = new TestInContextAsync()
            {
                Bind = (win) => HtmlBinding.Bind(win, root, JavascriptBindingMode.TwoWay, strategyFactory),
                Test = async(mb) =>
                {
                    var js = mb.JsRootObject;

                    var stopWatch = new Stopwatch();
                    stopWatch.Start();

                    await DoSafeAsyncUI(() => root.Value = value);

                    await Task.Delay(DelayForTimeOut);

                    var other = await _WebView.EvaluateAsync(() => GetAttribute(js, "Value"));

                    other.GetIntValue().Should().Be(value);

                    stopWatch.Stop();
                    var ts = stopWatch.ElapsedMilliseconds - DelayForTimeOut;
                    _Logger.Info($"Perf: {((double)(ts)) / 1000} sec");
                }
            };

            await RunAsync(test);
        }
예제 #2
0
        public void OnIntChangedTest()
        {
            bool isCalled = false;

            var intProp = new IntProperty();
            var intVm   = new IntViewModel(intProp);

            intVm.OnChanged.Subscribe(x => isCalled = true);

            intVm.IntValue.Value = 24;
            isCalled.IsTrue();
        }
예제 #3
0
        public ToleranceViewModel(IPropertyModel model, PropertyFactory propertyFactory, ViewModelFactory factory)
            : base(model, factory)
        {
            var catalog   = new AssemblyCatalog(Assembly.GetExecutingAssembly());
            var container = new CompositionContainer(catalog);

            UserControl             = container.GetExportedValue <UserControl>("ToleranceView");
            UserControl.DataContext = this;

            Blow     = Compounder.CreateIntViewModel("Blow");
            Gash     = Compounder.CreateIntViewModel("Gash");
            Burn     = Compounder.CreateIntViewModel("Burn");
            Chill    = Compounder.CreateIntViewModel("Chill");
            Electric = Compounder.CreateIntViewModel("Electric");
            Primal   = Compounder.CreateIntViewModel("Primal");
        }