${REST_ThemeGraphItem_Title}
${REST_ThemeGraphItem_Description}
internal static string ToJson(ThemeGraphItem graphItem) { string json = "{"; List<string> list = new List<string>(); if (!string.IsNullOrEmpty(graphItem.Caption)) { list.Add(string.Format("\"caption\":\"{0}\"", graphItem.Caption)); } else { list.Add("\"caption\":null"); } if (!string.IsNullOrEmpty(graphItem.GraphExpression)) { list.Add(string.Format("\"graphExpression\":\"{0}\"", graphItem.GraphExpression)); } else { list.Add("\"graphExpression\":null"); } //if (graphItem.RangeSetting != null) //{ // list.Add(string.Format("\"rangeSetting\":{0}", ThemeRange.ToJson(graphItem.RangeSetting))); //} //else //{ // list.Add("\"rangeSetting\":null"); //} if (graphItem.UniformStyle != null) { list.Add(string.Format("\"uniformStyle\":{0}", ServerStyle.ToJson(graphItem.UniformStyle))); } else { list.Add(string.Format("\"uniformStyle\":{0}", ServerStyle.ToJson(new ServerStyle()))); } if (graphItem.MemoryDoubleValues != null && graphItem.MemoryDoubleValues.Count > 0) { list.Add(string.Format("\"memoryDoubleValues\":[{0}]", string.Join(",", graphItem.MemoryDoubleValues))); } else { list.Add("\"memoryDoubleValues\":null"); } json += string.Join(",", list.ToArray()); json += "}"; return json; }
internal static ThemeGraphItem FromJson(JsonObject json) { if (json == null) return null; ThemeGraphItem graphItem = new ThemeGraphItem(); graphItem.Caption = json["caption"].GetStringEx(); graphItem.GraphExpression = json["graphExpression"].GetStringEx(); if (json["memoryDoubleValues"] != null) { List<double> memoryValues = new List<double>(); foreach (JsonObject item in json["memoryDoubleValues"].GetArray()) { memoryValues.Add(item.GetNumber()); } graphItem.MemoryDoubleValues = memoryValues; } graphItem.UniformStyle = ServerStyle.FromJson(json["uniformStyle"].GetObjectEx()); return graphItem; }