// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control // Copyright © 2024 Clemens Fischer // Licensed under the Microsoft Public License (Ms-PL) using System; using System.IO; using System.Threading.Tasks; using System.Windows.Media; namespace MapControl { public partial class TileImageLoader { /// /// Default folder where the Cache instance may save data, i.e. "C:\ProgramData\MapControl\TileCache". /// public static string DefaultCacheFolder => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MapControl", "TileCache"); private static async Task LoadTileAsync(Tile tile, Func> loadImageFunc) { var image = await loadImageFunc().ConfigureAwait(false); await tile.Image.Dispatcher.InvokeAsync(() => tile.SetImageSource(image)); } } }