mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-01-01 06:10:02 +01:00
Minor changes
This commit is contained in:
parent
2b3a8606c0
commit
7cdbca9c8c
|
|
@ -34,7 +34,7 @@ namespace MapControl
|
|||
return Math.Log(scale * 360d * MapProjection.Wgs84MeterPerDegree / 256d, 2d);
|
||||
}
|
||||
|
||||
public static TimeSpan ImageFadeDuration { get; set; } = TimeSpan.FromSeconds(0.1);
|
||||
public static TimeSpan ImageFadeDuration { get; set; } = TimeSpan.FromSeconds(0.2);
|
||||
|
||||
public static readonly DependencyProperty AnimationDurationProperty =
|
||||
DependencyPropertyHelper.Register<MapBase, TimeSpan>(nameof(AnimationDuration), TimeSpan.FromSeconds(0.3));
|
||||
|
|
|
|||
|
|
@ -188,41 +188,40 @@ namespace MapControl
|
|||
}
|
||||
|
||||
var cacheKey = $"{cacheName}/{tile.ZoomLevel}/{tile.Column}/{tile.Row}{extension}";
|
||||
byte[] buffer = null;
|
||||
|
||||
try
|
||||
{
|
||||
var cachedBuffer = await Cache.GetAsync(cacheKey).ConfigureAwait(false);
|
||||
|
||||
if (cachedBuffer != null)
|
||||
{
|
||||
return cachedBuffer;
|
||||
}
|
||||
buffer = await Cache.GetAsync(cacheKey).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger?.LogError(ex, "Cache.GetAsync({cacheKey})", cacheKey);
|
||||
}
|
||||
|
||||
(var buffer, var maxAge) = await ImageLoader.GetHttpResponseAsync(uri).ConfigureAwait(false);
|
||||
|
||||
if (buffer != null)
|
||||
if (buffer == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var options = new DistributedCacheEntryOptions
|
||||
{
|
||||
AbsoluteExpirationRelativeToNow =
|
||||
!maxAge.HasValue ? DefaultCacheExpiration
|
||||
: maxAge.Value < MinCacheExpiration ? MinCacheExpiration
|
||||
: maxAge.Value > MaxCacheExpiration ? MaxCacheExpiration
|
||||
: maxAge.Value
|
||||
};
|
||||
(buffer, var maxAge) = await ImageLoader.GetHttpResponseAsync(uri).ConfigureAwait(false);
|
||||
|
||||
await Cache.SetAsync(cacheKey, buffer, options).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
if (buffer != null)
|
||||
{
|
||||
Logger?.LogError(ex, "Cache.SetAsync({cacheKey})", cacheKey);
|
||||
try
|
||||
{
|
||||
var options = new DistributedCacheEntryOptions
|
||||
{
|
||||
AbsoluteExpirationRelativeToNow =
|
||||
!maxAge.HasValue ? DefaultCacheExpiration
|
||||
: maxAge.Value < MinCacheExpiration ? MinCacheExpiration
|
||||
: maxAge.Value > MaxCacheExpiration ? MaxCacheExpiration
|
||||
: maxAge.Value
|
||||
};
|
||||
|
||||
await Cache.SetAsync(cacheKey, buffer, options).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger?.LogError(ex, "Cache.SetAsync({cacheKey})", cacheKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue