mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-04 14:08:32 +00:00
Minor cleanup in TileImageLoader
This commit is contained in:
parent
ee4f049334
commit
f5acb5f908
6 changed files with 13 additions and 28 deletions
|
|
@ -15,7 +15,7 @@ namespace MapControl
|
|||
{
|
||||
Pending = false;
|
||||
|
||||
if (fadeIn && MapBase.ImageFadeDuration > TimeSpan.Zero)
|
||||
if (image != null && fadeIn && MapBase.ImageFadeDuration > TimeSpan.Zero)
|
||||
{
|
||||
if (image is BitmapSource bitmap && !bitmap.IsFrozen && bitmap.IsDownloading)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ namespace MapControl
|
|||
|
||||
if (cacheItem == null || cacheItem.Expiration < DateTime.UtcNow)
|
||||
{
|
||||
var response = await ImageLoader.GetHttpResponseAsync(uri, false).ConfigureAwait(false);
|
||||
var response = await ImageLoader.GetHttpResponseAsync(uri).ConfigureAwait(false);
|
||||
|
||||
if (response != null) // download succeeded
|
||||
{
|
||||
|
|
@ -58,7 +58,7 @@ namespace MapControl
|
|||
{
|
||||
var image = await ImageLoader.LoadImageAsync(buffer).ConfigureAwait(false);
|
||||
|
||||
SetTileImage(tile, image);
|
||||
await tile.Image.Dispatcher.InvokeAsync(() => tile.SetImage(image));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -66,15 +66,7 @@ namespace MapControl
|
|||
{
|
||||
var image = await tileSource.LoadImageAsync(tile.XIndex, tile.Y, tile.ZoomLevel).ConfigureAwait(false);
|
||||
|
||||
SetTileImage(tile, image);
|
||||
}
|
||||
|
||||
private static void SetTileImage(Tile tile, ImageSource image)
|
||||
{
|
||||
if (image != null)
|
||||
{
|
||||
tile.Image.Dispatcher.InvokeAsync(() => tile.SetImage(image));
|
||||
}
|
||||
await tile.Image.Dispatcher.InvokeAsync(() => tile.SetImage(image));
|
||||
}
|
||||
|
||||
private static Task<ImageCacheItem> GetCacheAsync(string cacheKey)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue