${iServerJava6R_ThemeLabelItem_Title}

${iServerJava6R_ThemeLabelItem_Description}

コード例 #1
0
 internal static ThemeLabelItem FromJson(JsonObject json)
 {
     if (json == null) return null;
     ThemeLabelItem item = new ThemeLabelItem();
     item.Caption = json["caption"];
     item.End = (double)json["end"];
     item.Start = (double)json["start"];
     if (json["style"] != null)
     {
         item.Style = ServerTextStyle.FromJson((JsonObject)json["style"]);
     }
     item.Visible = (bool)json["visible"];
     return item;
 }
コード例 #2
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(System.Globalization.CultureInfo.InvariantCulture).ToLower()));

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

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

            json += string.Join(",", list.ToArray());
            json += "}";
            return json;
        }