diff options
author | E.Z. Hart <hartez@users.noreply.github.com> | 2016-04-25 13:57:44 -0600 |
---|---|---|
committer | Rui Marinho <me@ruimarinho.net> | 2016-04-25 15:57:44 -0400 |
commit | 843bc4727a40d6ca67127326facf2333f461da2d (patch) | |
tree | 5467ab3850df7f2368baa1290e983adba27f35d9 /Xamarin.Forms.Platform.WinRT | |
parent | 07df05ced2b43446c84d47f4b7a8325abcd0f767 (diff) | |
download | xamarin-forms-843bc4727a40d6ca67127326facf2333f461da2d.tar.gz xamarin-forms-843bc4727a40d6ca67127326facf2333f461da2d.tar.bz2 xamarin-forms-843bc4727a40d6ca67127326facf2333f461da2d.zip |
Make core Ticker abstract and public (#116)
* Make core Ticker abstract and public
Make the core Ticker abstract and public so it can be inherited by platform
implementations; remove now-unused parts of original Ticker; add CreateTicker
to IPlatformServices; remove unused CreateTimer methods from IPlatformServices
* Add docs for Ticker
* Remove unnecessary Ticker.Default set
* Move Ticker into Internals
* Update Ticker docs
* Remove old Ticker docs
* Remove commented code
Diffstat (limited to 'Xamarin.Forms.Platform.WinRT')
-rw-r--r-- | Xamarin.Forms.Platform.WinRT/WindowsBasePlatformServices.cs | 27 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.WinRT/WindowsTicker.cs | 4 |
2 files changed, 6 insertions, 25 deletions
diff --git a/Xamarin.Forms.Platform.WinRT/WindowsBasePlatformServices.cs b/Xamarin.Forms.Platform.WinRT/WindowsBasePlatformServices.cs index 614a0972..603ec401 100644 --- a/Xamarin.Forms.Platform.WinRT/WindowsBasePlatformServices.cs +++ b/Xamarin.Forms.Platform.WinRT/WindowsBasePlatformServices.cs @@ -17,6 +17,7 @@ using Windows.Storage.Streams; using Windows.System; using Windows.UI.Core; using Windows.UI.Xaml; +using Xamarin.Forms.Internals; #if WINDOWS_UWP @@ -28,7 +29,7 @@ namespace Xamarin.Forms.Platform.WinRT { internal abstract class WindowsBasePlatformServices : IPlatformServices { - CoreDispatcher _dispatcher; + CoreDispatcher _dispatcher; public WindowsBasePlatformServices(CoreDispatcher dispatcher) { @@ -43,29 +44,9 @@ namespace Xamarin.Forms.Platform.WinRT _dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => action()).WatchForError(); } - public ITimer CreateTimer(Action<object> callback) + public Ticker CreateTicker() { - return new WindowsTimer(new Timer(o => callback(o), null, Timeout.Infinite, Timeout.Infinite)); - } - - public ITimer CreateTimer(Action<object> callback, object state, int dueTime, int period) - { - return new WindowsTimer(new Timer(o => callback(o), state, dueTime, period)); - } - - public ITimer CreateTimer(Action<object> callback, object state, long dueTime, long period) - { - return CreateTimer(callback, state, TimeSpan.FromMilliseconds(dueTime), TimeSpan.FromMilliseconds(period)); - } - - public ITimer CreateTimer(Action<object> callback, object state, TimeSpan dueTime, TimeSpan period) - { - return new WindowsTimer(new Timer(o => callback(o), state, dueTime, period)); - } - - public ITimer CreateTimer(Action<object> callback, object state, uint dueTime, uint period) - { - return CreateTimer(callback, state, TimeSpan.FromMilliseconds(dueTime), TimeSpan.FromMilliseconds(period)); + return new WindowsTicker(); } public virtual Assembly[] GetAssemblies() diff --git a/Xamarin.Forms.Platform.WinRT/WindowsTicker.cs b/Xamarin.Forms.Platform.WinRT/WindowsTicker.cs index 2e8d941d..2599813a 100644 --- a/Xamarin.Forms.Platform.WinRT/WindowsTicker.cs +++ b/Xamarin.Forms.Platform.WinRT/WindowsTicker.cs @@ -1,8 +1,8 @@ using System; using Windows.UI.Xaml; +using Xamarin.Forms.Internals; #if WINDOWS_UWP - namespace Xamarin.Forms.Platform.UWP #else @@ -11,7 +11,7 @@ namespace Xamarin.Forms.Platform.WinRT { internal class WindowsTicker : Ticker { - DispatcherTimer _timer; + readonly DispatcherTimer _timer; public WindowsTicker() { |