mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 22:46:58 +00:00
Fixed panning for UWP/WinUI
This commit is contained in:
parent
2ac4985c47
commit
e2f4fc13b1
6 changed files with 128 additions and 30 deletions
40
MapControl/WPF/Timer.WPF.cs
Normal file
40
MapControl/WPF/Timer.WPF.cs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
|
||||
// © 2021 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using System;
|
||||
#if UWP
|
||||
using Windows.UI.Xaml;
|
||||
#else
|
||||
using System.Windows;
|
||||
using System.Windows.Threading;
|
||||
#endif
|
||||
|
||||
namespace MapControl
|
||||
{
|
||||
internal static class Timer
|
||||
{
|
||||
public static DispatcherTimer CreateTimer(this DependencyObject obj, TimeSpan interval)
|
||||
{
|
||||
var timer = new DispatcherTimer
|
||||
{
|
||||
Interval = interval
|
||||
};
|
||||
|
||||
return timer;
|
||||
}
|
||||
|
||||
public static void Run(this DispatcherTimer timer, bool restart = false)
|
||||
{
|
||||
if (restart)
|
||||
{
|
||||
timer.Stop();
|
||||
}
|
||||
|
||||
if (!timer.IsEnabled)
|
||||
{
|
||||
timer.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue