mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-04 14:08:32 +00:00
Version 4.12.2 Improved ImageLoader/TileImageLoader
This commit is contained in:
parent
25bdf3050b
commit
4a7e384152
4 changed files with 54 additions and 57 deletions
|
|
@ -38,17 +38,19 @@ namespace MapControl
|
|||
|
||||
if (cacheBuffer == null || expiration < DateTime.UtcNow)
|
||||
{
|
||||
using (var stream = await ImageLoader.LoadImageStreamAsync(uri).ConfigureAwait(false))
|
||||
{
|
||||
if (stream != null) // download succeeded
|
||||
{
|
||||
cacheBuffer = null; // discard cached image
|
||||
var response = await ImageLoader.GetHttpResponseAsync(uri, false).ConfigureAwait(false);
|
||||
|
||||
if (stream.Length > 0) // tile image available
|
||||
if (response != null) // download succeeded
|
||||
{
|
||||
cacheBuffer = null; // discard cached image
|
||||
|
||||
if (response.Stream != null) // tile image available
|
||||
{
|
||||
using (var stream = response.Stream)
|
||||
{
|
||||
image = ImageLoader.LoadImage(stream);
|
||||
|
||||
SetCachedImage(cacheKey, stream, GetExpiration(stream.MaxAge));
|
||||
SetCachedImage(cacheKey, stream, GetExpiration(response.MaxAge));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue