summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.WinRT/WindowsTicker.cs
blob: 2599813a1a866f7d7859abaa8cb5906ea274a88a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System;
using Windows.UI.Xaml;
using Xamarin.Forms.Internals;

#if WINDOWS_UWP
namespace Xamarin.Forms.Platform.UWP
#else

namespace Xamarin.Forms.Platform.WinRT
#endif
{
	internal class WindowsTicker : Ticker
	{
		readonly DispatcherTimer _timer;

		public WindowsTicker()
		{
			_timer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(15) };
			_timer.Tick += (sender, args) => SendSignals();
		}

		protected override void DisableTimer()
		{
			_timer.Stop();
		}

		protected override void EnableTimer()
		{
			_timer.Start();
		}
	}
}