summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.ControlGallery.Windows
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.ControlGallery.Windows')
-rw-r--r--Xamarin.Forms.ControlGallery.Windows/BrokenImageSourceHandler.cs21
1 files changed, 20 insertions, 1 deletions
diff --git a/Xamarin.Forms.ControlGallery.Windows/BrokenImageSourceHandler.cs b/Xamarin.Forms.ControlGallery.Windows/BrokenImageSourceHandler.cs
index ffe999ee..42ee3402 100644
--- a/Xamarin.Forms.ControlGallery.Windows/BrokenImageSourceHandler.cs
+++ b/Xamarin.Forms.ControlGallery.Windows/BrokenImageSourceHandler.cs
@@ -1,16 +1,20 @@
using System;
using System.Threading;
using System.Threading.Tasks;
-
+using Xamarin.Forms.Controls.Issues;
using WImageSource = Windows.UI.Xaml.Media.ImageSource;
#if WINDOWS_UWP
using Xamarin.Forms.Platform.UWP;
+using Xamarin.Forms.ControlGallery.WindowsUniversal;
+[assembly: ExportRenderer(typeof(_51173Image), typeof(_51173CustomImageRenderer))]
namespace Xamarin.Forms.ControlGallery.WindowsUniversal
#else
using Xamarin.Forms.Platform.WinRT;
+using Xamarin.Forms.ControlGallery.WinRT;
+[assembly: ExportRenderer(typeof(_51173Image), typeof(_51173CustomImageRenderer))]
namespace Xamarin.Forms.ControlGallery.WinRT
#endif
{
@@ -21,4 +25,19 @@ namespace Xamarin.Forms.ControlGallery.WinRT
throw new Exception("Fail");
}
}
+
+ public class _51173CustomImageRenderer : ImageRenderer
+ {
+ protected override async Task TryUpdateSource()
+ {
+ try
+ {
+ await UpdateSource().ConfigureAwait(false);
+ }
+ catch (Exception ex)
+ {
+ await Xamarin.Forms.Application.Current.MainPage.DisplayAlert("Image Error 51173", $"The image failed to load, here's why: {ex.Message}", "OK");
+ }
+ }
+ }
} \ No newline at end of file