public async Task <IJavascriptObject> UpdateJavascriptObject(IJsCsGlue root)
        {
            if ((root == null) || (root.IsBasic()))
            {
                return(null);
            }

            var jvm = _SessionCache.GetMapper(root as IJsCsMappedBridge);
            var res = _SessionInjector.Inject(root.JsValue, jvm);

            if ((root.CValue != null) && (res == null))
            {
                throw ExceptionHelper.GetUnexpected();
            }

            await jvm.UpdateTask;

            return(res);
        }
示例#2
0
        private async Task <IJavascriptObject> InjectInHtmlSession(IJsCsGlue root)
        {
            if (!Context.JavascriptFrameworkIsMappingObject)
            {
                return(root?.JsValue);
            }

            if ((root == null) || (root.IsBasic()))
            {
                return(null);
            }

            var jvm = _SessionCache.GetMapper(root as IJsCsMappedBridge);
            var res = _SessionInjector.Inject(root.JsValue, jvm);

            if ((root.CValue != null) && (res == null))
            {
                throw ExceptionHelper.GetUnexpected();
            }

            await jvm.UpdateTask;

            return(res);
        }
示例#3
0
        public BridgeUpdater GetUpdaterChangeOnCSharpContext(AttributeUpdater propertyUpdater, IJsCsGlue glue)
        {
            var update = PrivateUpdateGlueProperty(propertyUpdater, glue);

            BridgeUpdater updater;

            if (!update.AddedProperty)
            {
                updater = new BridgeUpdater(viewModelUpdater => viewModelUpdater.UpdateProperty(CachableJsValue,
                                                                                                propertyUpdater.PropertyName, glue.GetJsSessionValue(), !glue.IsBasic()));
            }
            else
            {
                updater = new BridgeUpdater(viewModelUpdater => viewModelUpdater.AddProperty(CachableJsValue,
                                                                                             propertyUpdater.PropertyName, glue.GetJsSessionValue()));
            }

            return(updater.CheckForRemove(update.OldReference));
        }
 private IJavascriptObjectBuilderStrategy GetStrategy(IJsCsGlue root) => root.IsBasic()? _SynchroneousStrategy : _BulkStrategy;
        public BridgeUpdater GetUpdater(AttibuteUpdater propertyUpdater, IJsCsGlue glue)
        {
            var update = PrivateUpdateGlueProperty(propertyUpdater, glue);

            BridgeUpdater updater;

            if (!update.AddedProperty)
            {
                updater = new BridgeUpdater(viewModelUpdater => viewModelUpdater.UpdateProperty(CachableJsValue,
                                                                                                propertyUpdater.PropertyName, glue.GetJsSessionValue(), !glue.IsBasic()));
            }
            else
            {
                updater = new BridgeUpdater(viewModelUpdater => viewModelUpdater.AddProperty(CachableJsValue,
                                                                                             propertyUpdater.PropertyName, glue.GetJsSessionValue()));
            }

            return(updater.Remove(update.ToBeCleaned));
        }