Пример #1
0
 private static void SetImage(Xamarin.Forms.ImageCell cell, ImageCell target)
 {
     target.Image = null;
     _            = cell.ApplyNativeImageAsync(Xamarin.Forms.ImageCell.ImageSourceProperty, image =>
     {
         target.Image = image;
     });
 }
Пример #2
0
        private static async System.Threading.Tasks.Task SetImage(Xamarin.Forms.ImageCell cell, ImageCell target)
        {
            var source = cell.ImageSource;

            target.Image = null;

            Renderers.IImageSourceHandler handler;

            if (source != null && (handler =
                                       Internals.Registrar.Registered.GetHandlerForObject <Renderers.IImageSourceHandler>(source)) != null)
            {
                Gdk.Pixbuf image;

                try
                {
                    image = await handler.LoadImageAsync(source).ConfigureAwait(false);
                }
                catch (System.Threading.Tasks.TaskCanceledException)
                {
                    image = null;
                }
                catch (Exception)
                {
                    image = null;
                }

                target.Image = image;
            }
            else
            {
                target.Image = null;
            }
        }