${REST_ThemeLabelItem_Title}

${REST_ThemeLabelItem_Description}

Пример #1
0
        internal static string ToJson(ThemeLabelItem themeLabelItem)
        {
            string json = "{";
            List<string> list = new List<string>();

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

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

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

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

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

            json += string.Join(",", list.ToArray());
            json += "}";
            return json;
        }
Пример #2
0
 internal static ThemeLabelItem FromJson(JsonObject json)
 {
     if (json == null) return null;
     ThemeLabelItem item = new ThemeLabelItem();
     item.Caption = json["caption"].GetStringEx();
     item.End = json["end"].GetNumberEx();
     item.Start = json["start"].GetNumberEx();
     if (json["style"] != null)
     {
         item.Style = ServerTextStyle.FromJson(json["style"].GetObjectEx());
     }
     item.Visible = json["visible"].GetBooleanEx();
     return item;
 }