mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Version 4.12.2 Added TileQueue.
This commit is contained in:
parent
c6e2766d60
commit
9bfb663120
|
|
@ -60,7 +60,7 @@ namespace MapControl
|
|||
tileSource.UriFormat.StartsWith("http") &&
|
||||
!string.IsNullOrEmpty(sourceName))
|
||||
{
|
||||
tileQueue.RunDequeueTasks(MaxLoadTasks, tile => LoadTileImageAsync(tile, tileSource, sourceName));
|
||||
tileQueue.RunDequeueTasks(MaxLoadTasks, tile => LoadCachedTileImageAsync(tile, tileSource, sourceName));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -69,7 +69,7 @@ namespace MapControl
|
|||
}
|
||||
}
|
||||
|
||||
private async Task LoadTileImageAsync(Tile tile, TileSource tileSource, string sourceName)
|
||||
private async Task LoadCachedTileImageAsync(Tile tile, TileSource tileSource, string sourceName)
|
||||
{
|
||||
var uri = tileSource.GetUri(tile.XIndex, tile.Y, tile.ZoomLevel);
|
||||
|
||||
|
|
@ -84,7 +84,7 @@ namespace MapControl
|
|||
|
||||
var cacheKey = string.Format(CacheKeyFormat, sourceName, tile.ZoomLevel, tile.XIndex, tile.Y, extension);
|
||||
|
||||
await LoadTileImageAsync(tile, uri, cacheKey);
|
||||
await LoadCachedTileImageAsync(tile, uri, cacheKey);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace MapControl
|
|||
/// </summary>
|
||||
public static Caching.IImageCache Cache { get; set; }
|
||||
|
||||
private async Task LoadTileImageAsync(Tile tile, Uri uri, string cacheKey)
|
||||
private async Task LoadCachedTileImageAsync(Tile tile, Uri uri, string cacheKey)
|
||||
{
|
||||
var cacheItem = await Cache.GetAsync(cacheKey);
|
||||
var cacheBuffer = cacheItem?.Buffer;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ namespace MapControl
|
|||
/// </summary>
|
||||
public static ObjectCache Cache { get; set; } = MemoryCache.Default;
|
||||
|
||||
private async Task LoadTileImageAsync(Tile tile, Uri uri, string cacheKey)
|
||||
private async Task LoadCachedTileImageAsync(Tile tile, Uri uri, string cacheKey)
|
||||
{
|
||||
DateTime expiration;
|
||||
var cacheBuffer = GetCachedImage(cacheKey, out expiration);
|
||||
|
|
|
|||
Loading…
Reference in a new issue