static Element LoadDateTime (JsonObject json, string type)
{
var caption = GetString (json, "caption");
var date = GetString (json, "value");
DateTime datetime;
if (!DateTime.TryParse (date, out datetime))
return null;
switch (type){
case "date":
return new DateElement (caption, datetime);
case "time":
return new TimeElement (caption, datetime);
case "datetime":
return new DateTimeElement (caption, datetime);
default:
return null;
}
}