From f2a9dd9d0d6505ce51045f80b1caa632c1ca28cb Mon Sep 17 00:00:00 2001 From: ClemensF Date: Fri, 10 Aug 2018 00:20:35 +0200 Subject: [PATCH] Version 4.10.0: Updated target framework versions. Cleanup of TypeConverters, ImageLoader, MBTileSource. --- MapControl/UWP/ImageLoader.UWP.cs | 52 +++++++++++++-------------- MapControl/WPF/ImageLoader.WPF.cs | 58 +++++++++++++++---------------- 2 files changed, 55 insertions(+), 55 deletions(-) diff --git a/MapControl/UWP/ImageLoader.UWP.cs b/MapControl/UWP/ImageLoader.UWP.cs index 0b8cd655..e34d98b9 100644 --- a/MapControl/UWP/ImageLoader.UWP.cs +++ b/MapControl/UWP/ImageLoader.UWP.cs @@ -17,32 +17,6 @@ namespace MapControl { public static partial class ImageLoader { - public static async Task LoadLocalImageAsync(Uri uri) - { - ImageSource imageSource = null; - - try - { - var path = uri.IsAbsoluteUri ? uri.LocalPath : uri.OriginalString; - - if (File.Exists(path)) - { - var file = await StorageFile.GetFileFromPathAsync(path); - - using (var stream = await file.OpenReadAsync()) - { - imageSource = await CreateImageSourceAsync(stream); - } - } - } - catch (Exception ex) - { - Debug.WriteLine("ImageLoader: {0}: {1}", uri, ex.Message); - } - - return imageSource; - } - public static async Task> LoadHttpBufferAsync(Uri uri) { Tuple result = null; @@ -78,6 +52,32 @@ namespace MapControl return result; } + public static async Task LoadLocalImageAsync(Uri uri) + { + ImageSource imageSource = null; + + try + { + var path = uri.IsAbsoluteUri ? uri.LocalPath : uri.OriginalString; + + if (File.Exists(path)) + { + var file = await StorageFile.GetFileFromPathAsync(path); + + using (var stream = await file.OpenReadAsync()) + { + imageSource = await CreateImageSourceAsync(stream); + } + } + } + catch (Exception ex) + { + Debug.WriteLine("ImageLoader: {0}: {1}", uri, ex.Message); + } + + return imageSource; + } + public static async Task CreateImageSourceAsync(IRandomAccessStream stream) { var bitmapImage = new BitmapImage(); diff --git a/MapControl/WPF/ImageLoader.WPF.cs b/MapControl/WPF/ImageLoader.WPF.cs index 2d02351e..a4385283 100644 --- a/MapControl/WPF/ImageLoader.WPF.cs +++ b/MapControl/WPF/ImageLoader.WPF.cs @@ -17,35 +17,6 @@ namespace MapControl { public static partial class ImageLoader { - public static ImageSource LoadLocalImage(Uri uri) - { - ImageSource imageSource = null; - - try - { - var path = uri.IsAbsoluteUri ? uri.LocalPath : uri.OriginalString; - - if (File.Exists(path)) - { - using (var stream = File.OpenRead(path)) - { - imageSource = CreateImageSource(stream); - } - } - } - catch (Exception ex) - { - Debug.WriteLine("ImageLoader: {0}: {1}", uri, ex.Message); - } - - return imageSource; - } - - public static Task LoadLocalImageAsync(Uri uri) - { - return Task.Run(() => LoadLocalImage(uri)); - } - public static async Task> LoadHttpStreamAsync(Uri uri) { Tuple result = null; @@ -83,6 +54,35 @@ namespace MapControl return result; } + public static ImageSource LoadLocalImage(Uri uri) + { + ImageSource imageSource = null; + + try + { + var path = uri.IsAbsoluteUri ? uri.LocalPath : uri.OriginalString; + + if (File.Exists(path)) + { + using (var stream = File.OpenRead(path)) + { + imageSource = CreateImageSource(stream); + } + } + } + catch (Exception ex) + { + Debug.WriteLine("ImageLoader: {0}: {1}", uri, ex.Message); + } + + return imageSource; + } + + public static Task LoadLocalImageAsync(Uri uri) + { + return Task.Run(() => LoadLocalImage(uri)); + } + public static ImageSource CreateImageSource(Stream stream) { var bitmapImage = new BitmapImage();