mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-09 00:14:51 +00:00
Added UpdateTimer class
This commit is contained in:
parent
579631dd9d
commit
3fcb91f2d9
4 changed files with 38 additions and 32 deletions
|
|
@ -53,7 +53,7 @@ namespace MapControl
|
|||
DependencyPropertyHelper.Register<MapImageLayer, double>(nameof(LoadingProgress), 1d);
|
||||
|
||||
private readonly Progress<double> loadingProgress;
|
||||
private readonly DispatcherTimer updateTimer;
|
||||
private readonly UpdateTimer updateTimer;
|
||||
private bool updateInProgress;
|
||||
|
||||
public MapImageLayer()
|
||||
|
|
@ -62,7 +62,7 @@ namespace MapControl
|
|||
|
||||
loadingProgress = new Progress<double>(p => SetValue(LoadingProgressProperty, p));
|
||||
|
||||
updateTimer = new DispatcherTimer { Interval = UpdateInterval };
|
||||
updateTimer = new UpdateTimer { Interval = UpdateInterval };
|
||||
updateTimer.Tick += async (s, e) => await UpdateImageAsync();
|
||||
}
|
||||
|
||||
|
|
@ -164,15 +164,7 @@ namespace MapControl
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!UpdateWhileViewportChanging)
|
||||
{
|
||||
updateTimer.Stop();
|
||||
}
|
||||
|
||||
if (!updateTimer.IsEnabled)
|
||||
{
|
||||
updateTimer.Start();
|
||||
}
|
||||
updateTimer.Run(!UpdateWhileViewportChanging);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -207,9 +199,9 @@ namespace MapControl
|
|||
|
||||
updateInProgress = false;
|
||||
}
|
||||
else if (!updateTimer.IsEnabled) // update on next timer tick
|
||||
else // update on next timer tick
|
||||
{
|
||||
updateTimer.Start();
|
||||
updateTimer.Run();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue