${REST_ThemeRangeItem_Title}

${REST_ThemeRangeItem_Description}

コード例 #1
0
        internal static string ToJson(ThemeRangeItem themeRangeItem)
        {
            string json = "{";
            List<string> list = new List<string>();

            if (!string.IsNullOrEmpty(themeRangeItem.Caption))
            {
                list.Add(string.Format("\"caption\":\"{0}\"", themeRangeItem.Caption));
            }
            else
            {
                list.Add("\"caption\":\"\"");
            }

            if (themeRangeItem.Style != null)
            {
                list.Add(string.Format("\"style\":{0}", ServerStyle.ToJson(themeRangeItem.Style)));
            }
            else
            {
                list.Add(string.Format("\"style\":{0}", ServerStyle.ToJson(new ServerStyle())));
            }

            list.Add(string.Format("\"visible\":{0}", themeRangeItem.Visible.ToString().ToLower()));

            list.Add(string.Format("\"end\":{0}", themeRangeItem.End.ToString()));

            list.Add(string.Format("\"start\":{0}", themeRangeItem.Start.ToString()));

            json += string.Join(",", list.ToArray());
            json += "}";
            return json;
        }
コード例 #2
0
        internal static ThemeRangeItem FromJson(JsonObject json)
        {
            if (json == null) return null;
            ThemeRangeItem item = new ThemeRangeItem();

            item.Caption = json["caption"].GetStringEx();
            item.End = json["end"].GetNumberEx();
            item.Start = (json["start"].GetNumberEx());
            if (json["style"] != null)
            {
                item.Style = ServerStyle.FromJson(json["style"].GetObjectEx());
            }
            item.Visible = json["visible"].GetBooleanEx();
            return item;
        }