private static JToken ConvertToJson(IDataNodeDetail detail) { if (detail is ListDataNodeDetail list) { var ret = new JArray(); foreach (var item in list.Items) { ret.Add(item.Text); } return(ret); } else if (detail is FieldContainerDataNodeDetail fieldContainer) { var ret = new JObject(); foreach (var field in fieldContainer.Fields) { ret.Add(field.SchemaField.Name, field.FormattedText); } return(ret); } else { throw new ArgumentException($"Unexpected detail type: {detail.GetType()}"); } }
private IDataNodeDetailViewModel CreateDetail(IDataNodeDetail detail) => detail switch {