private static UIImage GetUIImageFromImageSource(FontImageSource source) { var handler = new FontImageSourceHandler(); // LoadImageAsync is not async, it just returns Task.FromResult return(handler.LoadImageAsync(source).Result); }
public static IImageSourceHandler GetDefaultHandler(this ImageSource source) { IImageSourceHandler handler = null; if (source is UriImageSource) { handler = new ImageLoaderSourceHandler(); } else if (source is FileImageSource) { handler = new FileImageSourceHandler(); } else if (source is StreamImageSource) { handler = new StreamImagesourceHandler(); } else if (source is FontImageSource) { handler = new FontImageSourceHandler(); } return(handler); }
public static IImageSourceHandler GetImageSourceHandler(ImageSource source) { IImageSourceHandler sourceHandler = null; if (source is UriImageSource) { sourceHandler = new ImageLoaderSourceHandler(); } else if (source is FileImageSource) { sourceHandler = new FileImageSourceHandler(); } else if (source is StreamImageSource) { sourceHandler = new StreamImagesourceHandler(); } else if (source is FontImageSource) { sourceHandler = new FontImageSourceHandler(); } return(sourceHandler); }
public OverviewMapRenderer(Context context) : base(context) { Task.Run(async() => { var bikeSource = new FontImageSource { FontFamily = Fonts.SolidIcons, Glyph = FontAwesomeIcons.Bicycle, Color = Color.Black }; var stationSource = new FontImageSource { FontFamily = Fonts.SolidIcons, Glyph = FontAwesomeIcons.Home, Color = Color.Black }; var loader = new FontImageSourceHandler(); _bikeBitmapDescriptor = BitmapDescriptorFactory.FromBitmap(await loader.LoadImageAsync(bikeSource, context)); _stationBitmapDescriptor = BitmapDescriptorFactory.FromBitmap(await loader.LoadImageAsync(stationSource, context)); }); }