XAML-Map-Control/MapControl/WPF/TileImageLoader.WPF.cs

17 lines
459 B
C#
Raw Normal View History

2025-02-27 18:46:32 +01:00
using System;
2017-08-04 21:38:58 +02:00
using System.Threading.Tasks;
2022-11-20 18:51:59 +01:00
using System.Windows.Media;
2017-08-04 21:38:58 +02:00
namespace MapControl
{
public partial class TileImageLoader
2017-08-04 21:38:58 +02:00
{
2025-01-26 22:40:33 +01:00
private static async Task LoadTileImage(Tile tile, Func<Task<ImageSource>> loadImageFunc)
{
2022-11-20 18:51:59 +01:00
var image = await loadImageFunc().ConfigureAwait(false);
2025-01-21 19:28:49 +01:00
_ = tile.Image.Dispatcher.InvokeAsync(() => tile.SetImageSource(image)); // no need to await InvokeAsync
2017-08-04 21:38:58 +02:00
}
}
}