Version 4.10.0: Updated target framework versions. Cleanup of TypeConverters, ImageLoader, MBTileSource.

This commit is contained in:
ClemensF 2018-08-09 18:58:47 +02:00
parent acf43d70ea
commit 1359cea83c
5 changed files with 61 additions and 45 deletions

View file

@ -20,17 +20,25 @@ namespace MapControl
public static async Task<ImageSource> LoadLocalImageAsync(Uri uri)
{
ImageSource imageSource = null;
var path = uri.IsAbsoluteUri ? uri.LocalPath : uri.OriginalString;
if (File.Exists(path))
try
{
var file = await StorageFile.GetFileFromPathAsync(path);
var path = uri.IsAbsoluteUri ? uri.LocalPath : uri.OriginalString;
using (var stream = await file.OpenReadAsync())
if (File.Exists(path))
{
imageSource = await CreateImageSourceAsync(stream);
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;
}