Update MapTileLayerBase.cs

This commit is contained in:
ClemensFischer 2025-01-26 21:14:18 +01:00
parent 1f8164e82d
commit 60c76a4b0b

View file

@ -31,7 +31,7 @@ namespace MapControl
{ {
public static readonly DependencyProperty TileSourceProperty = public static readonly DependencyProperty TileSourceProperty =
DependencyPropertyHelper.Register<MapTileLayerBase, TileSource>(nameof(TileSource), null, DependencyPropertyHelper.Register<MapTileLayerBase, TileSource>(nameof(TileSource), null,
async (layer, oldValue, newValue) => await layer.UpdateAsync(true)); async (layer, oldValue, newValue) => await layer.Update(true));
public static readonly DependencyProperty SourceNameProperty = public static readonly DependencyProperty SourceNameProperty =
DependencyPropertyHelper.Register<MapTileLayerBase, string>(nameof(SourceName)); DependencyPropertyHelper.Register<MapTileLayerBase, string>(nameof(SourceName));
@ -70,7 +70,7 @@ namespace MapControl
loadingProgress = new Progress<double>(p => SetValue(LoadingProgressProperty, p)); loadingProgress = new Progress<double>(p => SetValue(LoadingProgressProperty, p));
updateTimer = this.CreateTimer(UpdateInterval); updateTimer = this.CreateTimer(UpdateInterval);
updateTimer.Tick += async (s, e) => await UpdateAsync(false); updateTimer.Tick += async (s, e) => await Update(false);
MapPanel.SetRenderTransform(this, new MatrixTransform()); MapPanel.SetRenderTransform(this, new MatrixTransform());
#if WPF #if WPF
@ -201,7 +201,7 @@ namespace MapControl
return TileImageLoader.LoadTilesAsync(tiles, TileSource, cacheName, loadingProgress); return TileImageLoader.LoadTilesAsync(tiles, TileSource, cacheName, loadingProgress);
} }
private Task UpdateAsync(bool tileSourceChanged) private Task Update(bool tileSourceChanged)
{ {
updateTimer.Stop(); updateTimer.Stop();
@ -212,7 +212,7 @@ namespace MapControl
{ {
if (e.TransformCenterChanged || e.ProjectionChanged || Children.Count == 0) if (e.TransformCenterChanged || e.ProjectionChanged || Children.Count == 0)
{ {
await UpdateAsync(false); // update immediately await Update(false); // update immediately
} }
else else
{ {