Esempio n. 1
0
        public void ValueChanged(JSC.JSValue value)
        {
            string rez = null;

            if (value == null)
            {
                rez = "";
            }
            else
            {
                if (value.ValueType == JSC.JSValueType.Object)
                {
                    if (value.Value == null)
                    {
                        rez = "";
                    }
                    else
                    {
                        var sc = value["$type"];
                        if ((rez = sc.Value as string) == null)
                        {
                            rez = "Object";
                        }
                    }
                }
                else
                {
                    rez = value.ToString();
                }
            }
            this.Text = rez;
        }
Esempio n. 2
0
        internal protected override JSValue GetProperty(JSValue key, bool forWrite, PropertyScope memberScope)
        {
            if (memberScope < PropertyScope.Super && key._valueType != JSValueType.Symbol)
            {
                var nameStr = key.ToString();
                var res     = _context.GetVariable(nameStr, forWrite);
                return(res);
            }

            return(base.GetProperty(key, forWrite, memberScope));
        }
Esempio n. 3
0
        protected internal override bool DeleteProperty(JSValue name)
        {
            if (name._valueType == JSValueType.Integer)
            {
                switch (name._iValue)
                {
                case 0:
                    return(a0 == null || ((a0._attributes & JSValueAttributesInternal.DoNotDelete) == 0) && (a0 = null) == null);

                case 1:
                    return(a1 == null || ((a1._attributes & JSValueAttributesInternal.DoNotDelete) == 0) && (a1 = null) == null);

                case 2:
                    return(a2 == null || ((a2._attributes & JSValueAttributesInternal.DoNotDelete) == 0) && (a2 = null) == null);

                case 3:
                    return(a3 == null || ((a3._attributes & JSValueAttributesInternal.DoNotDelete) == 0) && (a3 = null) == null);

                case 4:
                    return(a4 == null || ((a4._attributes & JSValueAttributesInternal.DoNotDelete) == 0) && (a4 = null) == null);
                    //case 5:
                    //    return a5 == null || ((a5.attributes & JSObjectAttributesInternal.DoNotDelete) == 0) && (a5 = null) == null;
                    //case 6:
                    //    return a6 == null || ((a6.attributes & JSObjectAttributesInternal.DoNotDelete) == 0) && (a6 = null) == null;
                    //case 7:
                    //    return a7 == null || ((a7.attributes & JSObjectAttributesInternal.DoNotDelete) == 0) && (a7 = null) == null;
                }
            }
            switch (name.ToString())
            {
            case "0":
                return(a0 == null || ((a0._attributes & JSValueAttributesInternal.DoNotDelete) == 0) && (a0 = null) == null);

            case "1":
                return(a1 == null || ((a1._attributes & JSValueAttributesInternal.DoNotDelete) == 0) && (a1 = null) == null);

            case "2":
                return(a2 == null || ((a2._attributes & JSValueAttributesInternal.DoNotDelete) == 0) && (a2 = null) == null);

            case "3":
                return(a3 == null || ((a3._attributes & JSValueAttributesInternal.DoNotDelete) == 0) && (a3 = null) == null);

            case "4":
                return(a4 == null || ((a4._attributes & JSValueAttributesInternal.DoNotDelete) == 0) && (a4 = null) == null);
                //case "5":
                //    return a5 == null || ((a5.attributes & JSObjectAttributesInternal.DoNotDelete) == 0) && (a5 = null) == null;
                //case "6":
                //    return a6 == null || ((a6.attributes & JSObjectAttributesInternal.DoNotDelete) == 0) && (a6 = null) == null;
                //case "7":
                //    return a7 == null || ((a7.attributes & JSObjectAttributesInternal.DoNotDelete) == 0) && (a7 = null) == null;
            }
            return(base.DeleteProperty(name));
        }
Esempio n. 4
0
 public void ValueChanged(JSC.JSValue value)
 {
     if (value.ValueType == JSC.JSValueType.String)
     {
         _oldValue = value.Value as string;
     }
     else
     {
         _oldValue = value.ToString();
     }
     base.Text = _oldValue;
 }
Esempio n. 5
0
        public void ValueChanged(JSC.JSValue value)
        {
            ByteArray ba;

            if ((ba = value as ByteArray) != null || (ba = value.Value as ByteArray) != null)
            {
                _oldValue = BitConverter.ToString(ba.GetBytes());
            }
            else
            {
                _oldValue = value.ToString();
            }
            base.Text = _oldValue;
        }
Esempio n. 6
0
        protected internal override JSValue GetProperty(JSValue key, bool forWrite, PropertyScope memberScope)
        {
            if (forWrite)
            {
                cloneValues();
            }

            if (memberScope < PropertyScope.Super && key._valueType != JSValueType.Symbol)
            {
                forWrite &= (_attributes & JSValueAttributesInternal.Immutable) == 0;
                if (key._valueType == JSValueType.Integer)
                {
                    switch (key._iValue)
                    {
                    case 0:
                        return(a0 ?? (!forWrite ? notExists : (a0 = new JSValue()
                        {
                            _valueType = JSValueType.NotExistsInObject
                        })));

                    case 1:
                        return(a1 ?? (!forWrite ? notExists : (a1 = new JSValue()
                        {
                            _valueType = JSValueType.NotExistsInObject
                        })));

                    case 2:
                        return(a2 ?? (!forWrite ? notExists : (a2 = new JSValue()
                        {
                            _valueType = JSValueType.NotExistsInObject
                        })));

                    case 3:
                        return(a3 ?? (!forWrite ? notExists : (a3 = new JSValue()
                        {
                            _valueType = JSValueType.NotExistsInObject
                        })));

                    case 4:
                        return(a4 ?? (!forWrite ? notExists : (a4 = new JSValue()
                        {
                            _valueType = JSValueType.NotExistsInObject
                        })));
                    }
                }
                switch (key.ToString())
                {
                case "0":
                    return(a0 ?? (!forWrite ? notExists : (a0 = new JSValue()
                    {
                        _valueType = JSValueType.NotExistsInObject
                    })));

                case "1":
                    return(a1 ?? (!forWrite ? notExists : (a1 = new JSValue()
                    {
                        _valueType = JSValueType.NotExistsInObject
                    })));

                case "2":
                    return(a2 ?? (!forWrite ? notExists : (a2 = new JSValue()
                    {
                        _valueType = JSValueType.NotExistsInObject
                    })));

                case "3":
                    return(a3 ?? (!forWrite ? notExists : (a3 = new JSValue()
                    {
                        _valueType = JSValueType.NotExistsInObject
                    })));

                case "4":
                    return(a4 ?? (!forWrite ? notExists : (a4 = new JSValue()
                    {
                        _valueType = JSValueType.NotExistsInObject
                    })));

                case "length":
                {
                    if (_lengthContainer == null)
                    {
                        _lengthContainer = new _LengthContainer(this)
                        {
                            _valueType  = JSValueType.Integer,
                            _iValue     = length,
                            _attributes = JSValueAttributesInternal.DoNotEnumerate | JSValueAttributesInternal.Reassign
                        }
                    }
                    ;
                    return(_lengthContainer);
                }

                case "callee":
                {
                    if (callee == null)
                    {
                        callee = NotExistsInObject;
                    }

                    if (forWrite && (callee._attributes & JSValueAttributesInternal.SystemObject) != 0)
                    {
                        callee             = callee.CloneImpl(false);
                        callee._attributes = JSValueAttributesInternal.DoNotEnumerate;
                    }
                    return(callee);
                }

                case "caller":
                {
                    if (caller == null)
                    {
                        caller = NotExistsInObject;
                    }

                    if (forWrite && (caller._attributes & JSValueAttributesInternal.SystemObject) != 0)
                    {
                        caller             = caller.CloneImpl(false);
                        callee._attributes = JSValueAttributesInternal.DoNotEnumerate;
                    }
                    return(caller);
                }
                }
            }

            return(base.GetProperty(key, forWrite, memberScope));
        }
Esempio n. 7
0
 public void Response(bool success, JSC.JSValue value)
 {
     if (success)
     {
         _tcs.SetResult(true);
     }
     else
     {
         _tcs.SetException(new ApplicationException((value == null ? "FieldSetError" : value.ToString())));
     }
     _complete = true;
 }
Esempio n. 8
0
 public void Response(bool success, JSC.JSValue value)
 {
     if (success)
     {
         _topic.ValuePublished(this._value);
         _tcs.SetResult(true);
     }
     else
     {
         _tcs.SetException(new ApplicationException(value == null ? "TopicSetError" : value.ToString()));
     }
     _complete = true;
 }
Esempio n. 9
0
 public void Response(bool success, JSC.JSValue value)
 {
     if (success) // value == null after connect
     {
         if (value != null && (value.ValueType != JSC.JSValueType.Boolean || !((bool)value)))
         {
             _cur._disposed = true;
             var parent = _cur.parent;
             if (parent != null)
             {
                 parent.RemoveChild(_cur);
                 _cur.ChangedReise(Art.RemoveChild, _cur);
                 parent.ChangedReise(Art.RemoveChild, _cur);
             }
         }
     }
     else
     {
         _tcs.TrySetException(new ApplicationException((value == null ? "TopicReqError" : value.ToString())));
     }
 }