コード例 #1
0
        public override object ReadJson(JsonReader reader,
                                        Type t,
                                        object existingValue,
                                        JsonSerializer serializer)
        {
            switch (reader.TokenType)
            {
            case JsonToken.Integer:
            case JsonToken.Float:
                double doubleValue = serializer.Deserialize <double>(reader);

                return(new GridOpacity
                {
                    Double = doubleValue
                });

            case JsonToken.StartObject:
                ConditionalAxisPropertyNumberNullClass objectValue = serializer.Deserialize <ConditionalAxisPropertyNumberNullClass>(reader);

                return(new GridOpacity
                {
                    ConditionalAxisPropertyNumberNullClass = objectValue
                });
            }

            throw new Exception("Cannot unmarshal type GridOpacity");
        }
コード例 #2
0
        public override object ReadJson(JsonReader reader,
                                        Type t,
                                        object existingValue,
                                        JsonSerializer serializer)
        {
            switch (reader.TokenType)
            {
            case JsonToken.String:
            case JsonToken.Date:
                string stringValue = serializer.Deserialize <string>(reader);

                switch (stringValue)
                {
                case "center":
                    return(new LabelAlign
                    {
                        Enum = Align.Center
                    });

                case "left":
                    return(new LabelAlign
                    {
                        Enum = Align.Left
                    });

                case "right":
                    return(new LabelAlign
                    {
                        Enum = Align.Right
                    });
                }

                break;

            case JsonToken.StartObject:
                ConditionalAxisPropertyNumberNullClass objectValue = serializer.Deserialize <ConditionalAxisPropertyNumberNullClass>(reader);

                return(new LabelAlign
                {
                    ConditionalAxisPropertyNumberNullClass = objectValue
                });
            }

            throw new Exception("Cannot unmarshal type LabelAlign");
        }