mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-03 20:05:35 +02: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);
|
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 =
|
public static readonly DependencyProperty AnimationDurationProperty =
|
||||||
DependencyPropertyHelper.Register<MapBase, TimeSpan>(nameof(AnimationDuration), TimeSpan.FromSeconds(0.3));
|
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}";
|
var cacheKey = $"{cacheName}/{tile.ZoomLevel}/{tile.Column}/{tile.Row}{extension}";
|
||||||
|
byte[] buffer = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var cachedBuffer = await Cache.GetAsync(cacheKey).ConfigureAwait(false);
|
buffer = await Cache.GetAsync(cacheKey).ConfigureAwait(false);
|
||||||
|
|
||||||
if (cachedBuffer != null)
|
|
||||||
{
|
|
||||||
return cachedBuffer;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logger?.LogError(ex, "Cache.GetAsync({cacheKey})", cacheKey);
|
Logger?.LogError(ex, "Cache.GetAsync({cacheKey})", cacheKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
(var buffer, var maxAge) = await ImageLoader.GetHttpResponseAsync(uri).ConfigureAwait(false);
|
if (buffer == null)
|
||||||
|
|
||||||
if (buffer != null)
|
|
||||||
{
|
{
|
||||||
try
|
(buffer, var maxAge) = await ImageLoader.GetHttpResponseAsync(uri).ConfigureAwait(false);
|
||||||
{
|
|
||||||
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);
|
if (buffer != null)
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
{
|
||||||
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