diff options
Diffstat (limited to 'Xamarin.Forms.ControlGallery.Windows')
3 files changed, 32 insertions, 1 deletions
diff --git a/Xamarin.Forms.ControlGallery.Windows/BrokenImageSourceHandler.cs b/Xamarin.Forms.ControlGallery.Windows/BrokenImageSourceHandler.cs new file mode 100644 index 00000000..ffe999ee --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Windows/BrokenImageSourceHandler.cs @@ -0,0 +1,24 @@ +using System; +using System.Threading; +using System.Threading.Tasks; + +using WImageSource = Windows.UI.Xaml.Media.ImageSource; + +#if WINDOWS_UWP +using Xamarin.Forms.Platform.UWP; + +namespace Xamarin.Forms.ControlGallery.WindowsUniversal +#else +using Xamarin.Forms.Platform.WinRT; + +namespace Xamarin.Forms.ControlGallery.WinRT +#endif +{ + public sealed class BrokenImageSourceHandler : IImageSourceHandler + { + public Task<WImageSource> LoadImageAsync(ImageSource imagesource, CancellationToken cancellationToken = new CancellationToken()) + { + throw new Exception("Fail"); + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.ControlGallery.Windows/Properties/AssemblyInfo.cs b/Xamarin.Forms.ControlGallery.Windows/Properties/AssemblyInfo.cs index 89577935..cf2e0174 100644 --- a/Xamarin.Forms.ControlGallery.Windows/Properties/AssemblyInfo.cs +++ b/Xamarin.Forms.ControlGallery.Windows/Properties/AssemblyInfo.cs @@ -1,6 +1,9 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using Xamarin.Forms.ControlGallery.WinRT; +using Xamarin.Forms.Controls; +using Xamarin.Forms.Platform.WinRT; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information @@ -26,4 +29,7 @@ using System.Runtime.InteropServices; // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: ComVisible(false)]
\ No newline at end of file +[assembly: ComVisible(false)] + +// Deliberately broken image source and handler so we can test handling of image loading errors +[assembly: ExportImageSourceHandler(typeof(FailImageSource), typeof(BrokenImageSourceHandler))]
\ No newline at end of file diff --git a/Xamarin.Forms.ControlGallery.Windows/Xamarin.Forms.ControlGallery.Windows.csproj b/Xamarin.Forms.ControlGallery.Windows/Xamarin.Forms.ControlGallery.Windows.csproj index 6d03d703..c93c45b9 100644 --- a/Xamarin.Forms.ControlGallery.Windows/Xamarin.Forms.ControlGallery.Windows.csproj +++ b/Xamarin.Forms.ControlGallery.Windows/Xamarin.Forms.ControlGallery.Windows.csproj @@ -139,6 +139,7 @@ <Compile Include="App.xaml.cs"> <DependentUpon>App.xaml</DependentUpon> </Compile> + <Compile Include="BrokenImageSourceHandler.cs" /> <Compile Include="BrokenNativeControl.cs" /> <Compile Include="MainPage.xaml.cs"> <DependentUpon>MainPage.xaml</DependentUpon> |