Version 4.10.0: Improved ImageLoader and MBTiles.

This commit is contained in:
ClemensF 2018-08-15 23:29:03 +02:00
parent eca9178971
commit bdcd2597a1
13 changed files with 403 additions and 339 deletions

View file

@ -51,27 +51,20 @@ namespace MapControl
return imageSource;
}
public static async Task<ImageSource> LoadHttpImageAsync(Uri uri)
private static async Task<ImageSource> LoadHttpImageAsync(Uri uri)
{
ImageSource imageSource = null;
try
using (var response = await HttpClient.GetAsync(uri))
{
using (var response = await HttpClient.GetAsync(uri))
if (!response.IsSuccessStatusCode)
{
if (!response.IsSuccessStatusCode)
{
Debug.WriteLine("ImageLoader: {0}: {1} {2}", uri, (int)response.StatusCode, response.ReasonPhrase);
}
else if (IsTileAvailable(response.Headers))
{
imageSource = await CreateImageSourceAsync(response.Content);
}
Debug.WriteLine("ImageLoader: {0}: {1} {2}", uri, (int)response.StatusCode, response.ReasonPhrase);
}
else if (IsTileAvailable(response.Headers))
{
imageSource = await CreateImageSourceAsync(response.Content);
}
}
catch (Exception ex)
{
Debug.WriteLine("ImageLoader: {0}: {1}", uri, ex.Message);
}
return imageSource;

View file

@ -4,9 +4,13 @@
using System;
#if WINDOWS_UWP
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media.Animation;
#else
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Animation;
#endif
namespace MapControl
@ -37,5 +41,11 @@ namespace MapControl
return ((X % numTiles) + numTiles) % numTiles;
}
}
private void FadeIn()
{
Image.BeginAnimation(UIElement.OpacityProperty, new DoubleAnimation { From = 0d, To = 1d, Duration = FadeDuration, FillBehavior = FillBehavior.Stop });
Image.Opacity = 1d;
}
}
}