public override object ReadJson (Newtonsoft.Json.JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { if (reader.TokenType == JsonToken.String) { var val = (string)((JValue)JToken.ReadFrom(reader)).Value; var converter = new Eto.Drawing.ImageConverter(); return converter.ConvertFrom(val); } throw new JsonSerializationException("Image or Icon must be defined as a resource or file string"); }
public override object ReadJson(Newtonsoft.Json.JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { if (reader.TokenType == JsonToken.String) { var val = (string)((JValue)JToken.ReadFrom(reader)).Value; var converter = new Eto.Drawing.ImageConverter(); return(converter.ConvertFrom(val)); } throw new JsonSerializationException("Image or Icon must be defined as a resource or file string"); }