summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core
diff options
context:
space:
mode:
authorStephane Delcroix <stephane@delcroix.org>2016-12-22 08:34:30 (GMT)
committerGitHub <noreply@github.com>2016-12-22 08:34:30 (GMT)
commit9d2290b2ac6753b037edfc9f0b1cfeaa69c5d815 (patch)
tree735570b8900f645baef9ffb222e53aa9c36a5adc /Xamarin.Forms.Core
parentdf67dff982d45e6fb8d69b549b8683ca26f2a202 (diff)
downloadxamarin-forms-9d2290b2ac6753b037edfc9f0b1cfeaa69c5d815.zip
xamarin-forms-9d2290b2ac6753b037edfc9f0b1cfeaa69c5d815.tar.gz
xamarin-forms-9d2290b2ac6753b037edfc9f0b1cfeaa69c5d815.tar.bz2
Avoid duplicating code in OmPlatform (#591)
Diffstat (limited to 'Xamarin.Forms.Core')
-rw-r--r--Xamarin.Forms.Core/OnPlatform.cs19
1 files changed, 2 insertions, 17 deletions
diff --git a/Xamarin.Forms.Core/OnPlatform.cs b/Xamarin.Forms.Core/OnPlatform.cs
index 71879a7..02e2708 100644
--- a/Xamarin.Forms.Core/OnPlatform.cs
+++ b/Xamarin.Forms.Core/OnPlatform.cs
@@ -3,29 +3,14 @@ namespace Xamarin.Forms
public class OnPlatform<T>
{
public T Android { get; set; }
-
public T iOS { get; set; }
-
public T WinPhone { get; set; }
public T Tizen { get; set; }
public static implicit operator T(OnPlatform<T> onPlatform)
{
- switch (Device.OS)
- {
- case TargetPlatform.iOS:
- return onPlatform.iOS;
- case TargetPlatform.Android:
- return onPlatform.Android;
- case TargetPlatform.Windows:
- case TargetPlatform.WinPhone:
- return onPlatform.WinPhone;
- case TargetPlatform.Tizen:
- return onPlatform.Tizen;
- }
-
- return onPlatform.iOS;
+ return Device.OnPlatform(iOS: onPlatform.iOS, Android: onPlatform.Android, WinPhone: onPlatform.WinPhone, Tizen: onPlatform.Tizen);
}
}
-}
+} \ No newline at end of file