Converter to convert a string to an Image
상속: System.ComponentModel.TypeConverter
예제 #1
0
		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");
		}
예제 #2
0
 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");
 }