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 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));
            });
        }
Exemplo n.º 3
0
        private static Task <UIImage> LoadPlaceholderAsync()
        {
            switch (FormsHandler.PlaceholderImageSource)
            {
            case StreamImageSource streamImageSource:
                FormsHandler.Warn($"loading placeholder from resource");
                return(DefaultStreamImageSourceHandler.LoadImageAsync(streamImageSource));

                ;

            case FontImageSource fontImageSource:
                FormsHandler.Warn($"loading placeholder from Font");
                return(DefaultFontImageSourcehandler.LoadImageAsync(fontImageSource));

            default:
                FormsHandler.Warn($"no valid placeholder found");
                return(null);
            }
        }