mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 06:26:41 +00:00
Minor cleanup in TileImageLoader
This commit is contained in:
parent
ee4f049334
commit
f5acb5f908
6 changed files with 13 additions and 28 deletions
|
|
@ -16,7 +16,7 @@ namespace MapControl
|
|||
{
|
||||
Pending = false;
|
||||
|
||||
if (fadeIn && MapBase.ImageFadeDuration > TimeSpan.Zero)
|
||||
if (image != null && fadeIn && MapBase.ImageFadeDuration > TimeSpan.Zero)
|
||||
{
|
||||
if (image is BitmapImage bitmap && bitmap.UriSource != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -35,7 +35,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
|
||||
{
|
||||
|
|
@ -64,13 +64,7 @@ namespace MapControl
|
|||
{
|
||||
try
|
||||
{
|
||||
var image = await loadImageFunc();
|
||||
|
||||
if (image != null)
|
||||
{
|
||||
tile.SetImage(image);
|
||||
}
|
||||
|
||||
tile.SetImage(await loadImageFunc());
|
||||
tcs.SetResult(null);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
@ -79,7 +73,7 @@ namespace MapControl
|
|||
}
|
||||
});
|
||||
|
||||
await tcs.Task.ConfigureAwait(false);
|
||||
await tcs.Task.ConfigureAwait(false); // wait until image loading in the UI thread is completed
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue