summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.iOS
diff options
context:
space:
mode:
authoradrianknight89 <adrianknight89@outlook.com>2017-01-11 00:07:01 (GMT)
committerJason Smith <jason.smith@xamarin.com>2017-01-11 00:07:01 (GMT)
commitf78b328759bb673b695c6b0d1a1dac6d871d257a (patch)
tree53af7ed6bce1b2287ba7addd89f782dd4606d7c6 /Xamarin.Forms.Platform.iOS
parentdcea6b4853f76dbc4661c42c56244e0a70d889ed (diff)
downloadxamarin-forms-f78b328759bb673b695c6b0d1a1dac6d871d257a.zip
xamarin-forms-f78b328759bb673b695c6b0d1a1dac6d871d257a.tar.gz
xamarin-forms-f78b328759bb673b695c6b0d1a1dac6d871d257a.tar.bz2
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.iOS')
-rw-r--r--Xamarin.Forms.Platform.iOS/Forms.cs56
1 files changed, 7 insertions, 49 deletions
diff --git a/Xamarin.Forms.Platform.iOS/Forms.cs b/Xamarin.Forms.Platform.iOS/Forms.cs
index 06cb131..5361e13 100644
--- a/Xamarin.Forms.Platform.iOS/Forms.cs
+++ b/Xamarin.Forms.Platform.iOS/Forms.cs
@@ -68,9 +68,7 @@ namespace Xamarin.Forms
internal static void SendViewInitialized(this VisualElement self, UIView nativeView)
{
- var viewInitialized = ViewInitialized;
- if (viewInitialized != null)
- viewInitialized(self, new ViewInitializedEventArgs { View = self, NativeView = nativeView });
+ ViewInitialized?.Invoke(self, new ViewInitializedEventArgs { View = self, NativeView = nativeView });
}
class iOSExpressionSearch : ExpressionVisitor, IExpressionSearch
@@ -117,15 +115,9 @@ namespace Xamarin.Forms
public override Size PixelScreenSize { get; }
- public override Size ScaledScreenSize
- {
- get { return _scaledScreenSize; }
- }
+ public override Size ScaledScreenSize => _scaledScreenSize;
- public override double ScalingFactor
- {
- get { return _scalingFactor; }
- }
+ public override double ScalingFactor => _scalingFactor;
protected override void Dispose(bool disposing)
{
@@ -136,7 +128,7 @@ namespace Xamarin.Forms
class IOSPlatformServices : IPlatformServices
{
- static readonly MD5CryptoServiceProvider Checksum = new MD5CryptoServiceProvider();
+ static readonly MD5CryptoServiceProvider s_checksum = new MD5CryptoServiceProvider();
public void BeginInvokeOnMainThread(Action action)
{
@@ -155,7 +147,7 @@ namespace Xamarin.Forms
public string GetMD5Hash(string input)
{
- var bytes = Checksum.ComputeHash(Encoding.UTF8.GetBytes(input));
+ var bytes = s_checksum.ComputeHash(Encoding.UTF8.GetBytes(input));
var ret = new char[32];
for (var i = 0; i < 16; i++)
{
@@ -198,10 +190,7 @@ namespace Xamarin.Forms
return new _IsolatedStorageFile(IsolatedStorageFile.GetUserStoreForApplication());
}
- public bool IsInvokeRequired
- {
- get { return !NSThread.IsMain; }
- }
+ public bool IsInvokeRequired => !NSThread.IsMain;
public void OpenUriAction(Uri uri)
{
@@ -210,8 +199,7 @@ namespace Xamarin.Forms
public void StartTimer(TimeSpan interval, Func<bool> callback)
{
- NSTimer timer = null;
- timer = NSTimer.CreateRepeatingScheduledTimer(interval, t =>
+ NSTimer timer = NSTimer.CreateRepeatingTimer(interval, t =>
{
if (!callback())
t.Invalidate();
@@ -238,36 +226,6 @@ namespace Xamarin.Forms
return 'a' + v - 10;
}
- public class _Timer : ITimer
- {
- readonly Timer _timer;
-
- public _Timer(Timer timer)
- {
- _timer = timer;
- }
-
- public void Change(int dueTime, int period)
- {
- _timer.Change(dueTime, period);
- }
-
- public void Change(long dueTime, long period)
- {
- _timer.Change(dueTime, period);
- }
-
- public void Change(TimeSpan dueTime, TimeSpan period)
- {
- _timer.Change(dueTime, period);
- }
-
- public void Change(uint dueTime, uint period)
- {
- _timer.Change(dueTime, period);
- }
- }
-
public class _IsolatedStorageFile : IIsolatedStorageFile
{
readonly IsolatedStorageFile _isolatedStorageFile;