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

20 lines
585 B
C#
Raw Normal View History

2024-05-19 23:23:27 +02:00
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
2025-01-01 18:57:55 +01:00
// Copyright © Clemens Fischer
2024-05-19 23:23:27 +02:00
// Licensed under the Microsoft Public License (Ms-PL)
using System;
using System.Threading.Tasks;
namespace MapControl
{
public partial class TileImageLoader
{
private static async Task LoadTileAsync(Tile tile, Func<Task<IImage>> loadImageFunc)
{
var image = await loadImageFunc().ConfigureAwait(false);
2025-01-21 19:28:49 +01:00
_ = Dispatcher.UIThread.InvokeAsync(() => tile.SetImageSource(image)); // no need to await InvokeAsync
2024-05-19 23:23:27 +02:00
}
}
}