mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 14:37:01 +00:00
Improved TileImageLoader
This commit is contained in:
parent
fb00a11f4b
commit
5fde94acb9
7 changed files with 88 additions and 60 deletions
|
|
@ -2,11 +2,11 @@
|
|||
// © 2021 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using Microsoft.UI.Dispatching;
|
||||
using Microsoft.UI.Xaml.Media;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.UI.Dispatching;
|
||||
using Microsoft.UI.Xaml.Media;
|
||||
|
||||
namespace MapControl
|
||||
{
|
||||
|
|
@ -31,7 +31,7 @@ namespace MapControl
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// An IImageCache implementation used to cache tile images. The default is null.
|
||||
/// An IImageCache implementation used to cache tile images.
|
||||
/// </summary>
|
||||
public static Caching.IImageCache Cache { get; set; }
|
||||
|
||||
|
|
@ -69,7 +69,7 @@ namespace MapControl
|
|||
{
|
||||
var tcs = new TaskCompletionSource();
|
||||
|
||||
tile.Image.DispatcherQueue.TryEnqueue(DispatcherQueuePriority.Low, async () =>
|
||||
async void callback()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -80,7 +80,13 @@ namespace MapControl
|
|||
{
|
||||
tcs.TrySetException(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (!tile.Image.DispatcherQueue.TryEnqueue(DispatcherQueuePriority.Low, callback))
|
||||
{
|
||||
tile.Pending = true;
|
||||
tcs.TrySetResult();
|
||||
}
|
||||
|
||||
return tcs.Task;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue