mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Update TileImageLoader.cs
This commit is contained in:
parent
8610f77899
commit
23d8256865
|
|
@ -19,9 +19,9 @@ namespace MapControl
|
|||
public partial class TileImageLoader : ITileImageLoader
|
||||
{
|
||||
/// <summary>
|
||||
/// Maximum number of parallel tile loading tasks. The default value is 4.
|
||||
/// Maximum number of parallel tile loading tasks. The default value is 8.
|
||||
/// </summary>
|
||||
public static int MaxLoadTasks { get; set; } = 4;
|
||||
public static int MaxLoadTasks { get; set; } = 8;
|
||||
|
||||
/// <summary>
|
||||
/// Default expiration time for cached tile images. Used when no expiration time
|
||||
|
|
@ -29,16 +29,6 @@ namespace MapControl
|
|||
/// </summary>
|
||||
public static TimeSpan DefaultCacheExpiration { get; set; } = TimeSpan.FromDays(1);
|
||||
|
||||
/// <summary>
|
||||
/// Minimum expiration time for cached tile images. The default value is one day.
|
||||
/// </summary>
|
||||
public static TimeSpan MinCacheExpiration { get; set; } = TimeSpan.FromDays(1);
|
||||
|
||||
/// <summary>
|
||||
/// Maximum expiration time for cached tile images. The default value is one week.
|
||||
/// </summary>
|
||||
public static TimeSpan MaxCacheExpiration { get; set; } = TimeSpan.FromDays(7);
|
||||
|
||||
/// <summary>
|
||||
/// Format string for creating cache keys from the sourceName argument passed to LoadTilesAsync,
|
||||
/// the ZoomLevel, XIndex, and Y properties of a Tile, and the image file extension.
|
||||
|
|
@ -146,23 +136,7 @@ namespace MapControl
|
|||
|
||||
private static DateTime GetExpiration(TimeSpan? maxAge)
|
||||
{
|
||||
var expiration = DefaultCacheExpiration;
|
||||
|
||||
if (maxAge.HasValue)
|
||||
{
|
||||
expiration = maxAge.Value;
|
||||
|
||||
if (expiration < MinCacheExpiration)
|
||||
{
|
||||
expiration = MinCacheExpiration;
|
||||
}
|
||||
else if (expiration > MaxCacheExpiration)
|
||||
{
|
||||
expiration = MaxCacheExpiration;
|
||||
}
|
||||
}
|
||||
|
||||
return DateTime.UtcNow.Add(expiration);
|
||||
return DateTime.UtcNow.Add(maxAge ?? DefaultCacheExpiration);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue