XAML-Map-Control/MapControl/Shared/UpdateTimer.cs

28 lines
415 B
C#
Raw Normal View History

2025-10-26 17:52:54 +01:00
#if WPF
using System.Windows.Threading;
#elif UWP
using Windows.UI.Xaml;
#elif WINUI
using Microsoft.UI.Xaml;
#elif AVALONIA
using Avalonia.Threading;
#endif
2026-04-13 17:14:49 +02:00
namespace MapControl;
internal class UpdateTimer : DispatcherTimer
2025-10-26 17:52:54 +01:00
{
2026-04-13 17:14:49 +02:00
public void Run(bool restart = false)
2025-10-26 17:52:54 +01:00
{
2026-04-13 17:14:49 +02:00
if (restart)
2025-10-26 17:52:54 +01:00
{
2026-04-13 17:14:49 +02:00
Stop();
}
2025-10-26 17:52:54 +01:00
2026-04-13 17:14:49 +02:00
if (!IsEnabled)
{
Start();
2025-10-26 17:52:54 +01:00
}
}
}