summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.WinRT/FileImageSourceHandler.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Platform.WinRT/FileImageSourceHandler.cs')
-rw-r--r--Xamarin.Forms.Platform.WinRT/FileImageSourceHandler.cs29
1 files changed, 29 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.WinRT/FileImageSourceHandler.cs b/Xamarin.Forms.Platform.WinRT/FileImageSourceHandler.cs
new file mode 100644
index 00000000..c9c6f16b
--- /dev/null
+++ b/Xamarin.Forms.Platform.WinRT/FileImageSourceHandler.cs
@@ -0,0 +1,29 @@
+´╗┐using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Windows.UI.Xaml.Media.Imaging;
+
+#if WINDOWS_UWP
+
+namespace Xamarin.Forms.Platform.UWP
+#else
+
+namespace Xamarin.Forms.Platform.WinRT
+#endif
+{
+ public sealed class FileImageSourceHandler : IImageSourceHandler
+ {
+ public Task<Windows.UI.Xaml.Media.ImageSource> LoadImageAsync(ImageSource imagesoure, CancellationToken cancellationToken = new CancellationToken())
+ {
+ Windows.UI.Xaml.Media.ImageSource image = null;
+ var filesource = imagesoure as FileImageSource;
+ if (filesource != null)
+ {
+ string file = filesource.File;
+ image = new BitmapImage(new Uri("ms-appx:///" + file));
+ }
+
+ return Task.FromResult(image);
+ }
+ }
+} \ No newline at end of file