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

29 lines
947 B
C#
Raw Normal View History

2017-08-04 21:38:58 +02:00
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
2024-02-03 21:01:53 +01:00
// Copyright © 2024 Clemens Fischer
2017-08-04 21:38:58 +02:00
// Licensed under the Microsoft Public License (Ms-PL)
using System;
using System.IO;
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
{
/// <summary>
2024-02-08 21:36:46 +01:00
/// Default folder where the Cache instance may save data, i.e. C:\ProgramData\MapControl\TileCache
2017-08-04 21:38:58 +02:00
/// </summary>
2022-08-06 10:40:59 +02:00
public static string DefaultCacheFolder =>
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MapControl", "TileCache");
2017-08-04 21:38:58 +02:00
private static async Task LoadTileAsync(Tile tile, Func<Task<ImageSource>> loadImageFunc)
{
2022-11-20 18:51:59 +01:00
var image = await loadImageFunc().ConfigureAwait(false);
2022-11-17 23:11:40 +01:00
await tile.Image.Dispatcher.InvokeAsync(() => tile.SetImageSource(image));
2017-08-04 21:38:58 +02:00
}
}
}