예제 #1
0
        public void UpdateCSharpProperty(string PropertyName, IJSCBridgeCache converter, JSValue newValue )
        {
            PropertyInfo propertyInfo = CValue.GetType().GetProperty(PropertyName, BindingFlags.Public | BindingFlags.Instance);
            if (!propertyInfo.CanWrite)
                return;

            var type = propertyInfo.PropertyType.GetUnderlyingNullableType() ?? propertyInfo.PropertyType;
            IJSCSGlue glue = converter.GetCachedOrCreateBasic(newValue, type);
            _Attributes[PropertyName] = glue;
            propertyInfo.SetValue(CValue, glue.CValue, null);
        }
        public IEnumerable <IndividualCollectionChange> GetIndividualChanges(JSValue[] value, JSValue[] status, JSValue[] index)
        {
            int Length = value.Length;

            for (int i = 0; i < Length; i++)
            {
                yield return(new IndividualCollectionChange(
                                 (string)status[i] == "added" ? CollectionChangeType.Add : CollectionChangeType.Remove,
                                 (int)index[i],
                                 _IJSCBridgeCache.GetCachedOrCreateBasic(value[i], _TargetedType)));
            }
        }
예제 #3
0
        public IEnumerable <IndividualCollectionChange> GetIndividualChanges(IJavascriptObject[] value, IJavascriptObject[] status, IJavascriptObject[] index)
        {
            int Length = value.Length;

            for (int i = 0; i < Length; i++)
            {
                yield return(new IndividualCollectionChange(
                                 status[i].GetStringValue() == "added" ? CollectionChangeType.Add : CollectionChangeType.Remove,
                                 index[i].GetIntValue(),
                                 _IJSCBridgeCache.GetCachedOrCreateBasic(value[i], _TargetedType)));
            }
        }
예제 #4
0
        public void UpdateCSharpProperty(string PropertyName, IJSCBridgeCache converter, IJavascriptObject newValue)
        {
            PropertyInfo propertyInfo = CValue.GetType().GetProperty(PropertyName, BindingFlags.Public | BindingFlags.Instance);

            if (!propertyInfo.CanWrite)
            {
                return;
            }

            var       type = propertyInfo.PropertyType.GetUnderlyingNullableType() ?? propertyInfo.PropertyType;
            IJSCSGlue glue = converter.GetCachedOrCreateBasic(newValue, type);

            _Attributes[PropertyName] = glue;
            propertyInfo.SetValue(CValue, glue.CValue, null);
        }
예제 #5
0
        private object Convert(IJSCBridgeCache mapper, IJavascriptObject value)
        {
            var found = mapper.GetCachedOrCreateBasic(value, null);

            return((found != null) ? found.CValue : null);
        }
예제 #6
0
 private object Convert(IJSCBridgeCache mapper, IJavascriptObject value)
 {
     var found = mapper.GetCachedOrCreateBasic(value, null);
     return (found != null) ? found.CValue : null;
 }