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
507bc93d99
commit
115525cbfc
|
|
@ -91,8 +91,15 @@ namespace MapControl
|
||||||
|
|
||||||
progress?.Report((double)(tileCount - tileStack.Count) / tileCount);
|
progress?.Report((double)(tileCount - tileStack.Count) / tileCount);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
await LoadTileAsync(tile, tileSource, cacheName).ConfigureAwait(false);
|
await LoadTileAsync(tile, tileSource, cacheName).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Debug.WriteLine($"{nameof(TileImageLoader)}: {tile.ZoomLevel}/{tile.Column}/{tile.Row}: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < taskCount; i++)
|
for (int i = 0; i < taskCount; i++)
|
||||||
|
|
@ -107,10 +114,9 @@ namespace MapControl
|
||||||
|
|
||||||
private static async Task LoadTileAsync(Tile tile, TileSource tileSource, string cacheName)
|
private static async Task LoadTileAsync(Tile tile, TileSource tileSource, string cacheName)
|
||||||
{
|
{
|
||||||
// Both tileSource.LoadImageAsync calls below are executed in the UI thread in WinUI and UWP.
|
// Pass tileSource.LoadImageAsync calls to platform-specific method
|
||||||
|
// LoadTileAsync(Tile, Func<Task<ImageSource>>) for execution on the UI thread in WinUI/UWP.
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(cacheName))
|
if (string.IsNullOrEmpty(cacheName))
|
||||||
{
|
{
|
||||||
await LoadTileAsync(tile, () => tileSource.LoadImageAsync(tile.Column, tile.Row, tile.ZoomLevel)).ConfigureAwait(false);
|
await LoadTileAsync(tile, () => tileSource.LoadImageAsync(tile.Column, tile.Row, tile.ZoomLevel)).ConfigureAwait(false);
|
||||||
|
|
@ -130,11 +136,6 @@ namespace MapControl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Debug.WriteLine($"{nameof(TileImageLoader)}: {tile.ZoomLevel}/{tile.Column}/{tile.Row}: {ex.Message}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task<byte[]> LoadCachedBufferAsync(Tile tile, Uri uri, string cacheName)
|
private static async Task<byte[]> LoadCachedBufferAsync(Tile tile, Uri uri, string cacheName)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue