diff options
author | adrianknight89 <adrianknight89@outlook.com> | 2017-01-10 18:07:01 -0600 |
---|---|---|
committer | Jason Smith <jason.smith@xamarin.com> | 2017-01-10 16:07:01 -0800 |
commit | f78b328759bb673b695c6b0d1a1dac6d871d257a (patch) | |
tree | 53af7ed6bce1b2287ba7addd89f782dd4606d7c6 /Xamarin.Forms.Platform.WinRT | |
parent | dcea6b4853f76dbc4661c42c56244e0a70d889ed (diff) | |
download | xamarin-forms-f78b328759bb673b695c6b0d1a1dac6d871d257a.tar.gz xamarin-forms-f78b328759bb673b695c6b0d1a1dac6d871d257a.tar.bz2 xamarin-forms-f78b328759bb673b695c6b0d1a1dac6d871d257a.zip |
iOS and Android timers should be runnable from any thread and execute… (#374)
* iOS and Android timers should be runnable from any thread and executed on the main thread
* removing unused Timer class declarations with minor refactoring efforts
* iOS and Android timers should be runnable from any thread and executed on the main thread
* removing bak file
* switch to v7
* add test code
Diffstat (limited to 'Xamarin.Forms.Platform.WinRT')
-rw-r--r-- | Xamarin.Forms.Platform.WinRT/WindowsBasePlatformServices.cs | 39 |
1 files changed, 4 insertions, 35 deletions
diff --git a/Xamarin.Forms.Platform.WinRT/WindowsBasePlatformServices.cs b/Xamarin.Forms.Platform.WinRT/WindowsBasePlatformServices.cs index 49589a8a..310b66c3 100644 --- a/Xamarin.Forms.Platform.WinRT/WindowsBasePlatformServices.cs +++ b/Xamarin.Forms.Platform.WinRT/WindowsBasePlatformServices.cs @@ -29,12 +29,12 @@ namespace Xamarin.Forms.Platform.WinRT { internal abstract class WindowsBasePlatformServices : IPlatformServices { - CoreDispatcher _dispatcher; + readonly CoreDispatcher _dispatcher; - public WindowsBasePlatformServices(CoreDispatcher dispatcher) + protected WindowsBasePlatformServices(CoreDispatcher dispatcher) { if (dispatcher == null) - throw new ArgumentNullException("dispatcher"); + throw new ArgumentNullException(nameof(dispatcher)); _dispatcher = dispatcher; } @@ -57,9 +57,8 @@ namespace Xamarin.Forms.Platform.WinRT IReadOnlyList<StorageFile> files = query.GetFilesAsync().AsTask().Result; var assemblies = new List<Assembly>(files.Count); - for (var i = 0; i < files.Count; i++) + foreach (StorageFile file in files) { - StorageFile file = files[i]; try { Assembly assembly = Assembly.Load(new AssemblyName { Name = Path.GetFileNameWithoutExtension(file.Name) }); @@ -133,35 +132,5 @@ namespace Xamarin.Forms.Platform.WinRT timer.Stop(); }; } - - internal class WindowsTimer : ITimer - { - readonly Timer _timer; - - public WindowsTimer(Timer timer) - { - _timer = timer; - } - - public void Change(int dueTime, int period) - { - _timer.Change(dueTime, period); - } - - public void Change(long dueTime, long period) - { - Change(TimeSpan.FromMilliseconds(dueTime), TimeSpan.FromMilliseconds(period)); - } - - public void Change(TimeSpan dueTime, TimeSpan period) - { - _timer.Change(dueTime, period); - } - - public void Change(uint dueTime, uint period) - { - Change(TimeSpan.FromMilliseconds(dueTime), TimeSpan.FromMilliseconds(period)); - } - } } }
\ No newline at end of file |