summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core
diff options
context:
space:
mode:
authorKangho <rookiejava+github@gmail.com>2016-12-14 21:24:59 (GMT)
committerJason Smith <jason.smith@xamarin.com>2016-12-14 21:24:59 (GMT)
commit1c5de535739e92d0c6dca335c024503b08d1a2af (patch)
tree1ae9ab1eb0608ee4830a8194063dc4b371890833 /Xamarin.Forms.Core
parent2a9c6f75cfab2699cbb398f0439c4451fe180766 (diff)
downloadxamarin-forms-1c5de535739e92d0c6dca335c024503b08d1a2af.zip
xamarin-forms-1c5de535739e92d0c6dca335c024503b08d1a2af.tar.gz
xamarin-forms-1c5de535739e92d0c6dca335c024503b08d1a2af.tar.bz2
Add Tizen to TargetPlatform (#590)
* Add Tizen to TargetPlatform * Adds Device.OnPlatform methods having Tizen
Diffstat (limited to 'Xamarin.Forms.Core')
-rw-r--r--Xamarin.Forms.Core/Device.cs27
-rw-r--r--Xamarin.Forms.Core/OnPlatform.cs6
-rw-r--r--Xamarin.Forms.Core/PlatformConfiguration/ExtensionPoints.cs1
-rw-r--r--Xamarin.Forms.Core/TargetPlatform.cs5
4 files changed, 36 insertions, 3 deletions
diff --git a/Xamarin.Forms.Core/Device.cs b/Xamarin.Forms.Core/Device.cs
index db0a274..50fdcfc 100644
--- a/Xamarin.Forms.Core/Device.cs
+++ b/Xamarin.Forms.Core/Device.cs
@@ -88,6 +88,21 @@ namespace Xamarin.Forms
}
}
+ public static void OnPlatform(Action iOS = null, Action Android = null, Action WinPhone = null, Action Default = null, Action Tizen = null)
+ {
+ if (OS == TargetPlatform.Tizen)
+ {
+ if (Tizen != null)
+ Tizen();
+ else if (Default != null)
+ Default();
+ }
+ else
+ {
+ OnPlatform(iOS, Android, WinPhone, Default);
+ }
+ }
+
public static T OnPlatform<T>(T iOS, T Android, T WinPhone)
{
switch (OS)
@@ -104,6 +119,18 @@ namespace Xamarin.Forms
return iOS;
}
+ public static T OnPlatform<T>(T iOS, T Android, T WinPhone, T Tizen)
+ {
+ if (OS == TargetPlatform.Tizen)
+ {
+ return Tizen;
+ }
+ else
+ {
+ return OnPlatform<T>(iOS, Android, WinPhone);
+ }
+ }
+
public static void OpenUri(Uri uri)
{
PlatformServices.OpenUriAction(uri);
diff --git a/Xamarin.Forms.Core/OnPlatform.cs b/Xamarin.Forms.Core/OnPlatform.cs
index b66167f..71879a7 100644
--- a/Xamarin.Forms.Core/OnPlatform.cs
+++ b/Xamarin.Forms.Core/OnPlatform.cs
@@ -8,6 +8,8 @@ namespace Xamarin.Forms
public T WinPhone { get; set; }
+ public T Tizen { get; set; }
+
public static implicit operator T(OnPlatform<T> onPlatform)
{
switch (Device.OS)
@@ -19,9 +21,11 @@ namespace Xamarin.Forms
case TargetPlatform.Windows:
case TargetPlatform.WinPhone:
return onPlatform.WinPhone;
+ case TargetPlatform.Tizen:
+ return onPlatform.Tizen;
}
return onPlatform.iOS;
}
}
-} \ No newline at end of file
+}
diff --git a/Xamarin.Forms.Core/PlatformConfiguration/ExtensionPoints.cs b/Xamarin.Forms.Core/PlatformConfiguration/ExtensionPoints.cs
index 341d931..b74e9b9 100644
--- a/Xamarin.Forms.Core/PlatformConfiguration/ExtensionPoints.cs
+++ b/Xamarin.Forms.Core/PlatformConfiguration/ExtensionPoints.cs
@@ -4,4 +4,5 @@ namespace Xamarin.Forms.PlatformConfiguration
public sealed class Android : IConfigPlatform { }
public sealed class iOS : IConfigPlatform { }
public sealed class Windows : IConfigPlatform { }
+ public sealed class Tizen : IConfigPlatform { }
}
diff --git a/Xamarin.Forms.Core/TargetPlatform.cs b/Xamarin.Forms.Core/TargetPlatform.cs
index d9fe6b7..62fbda0 100644
--- a/Xamarin.Forms.Core/TargetPlatform.cs
+++ b/Xamarin.Forms.Core/TargetPlatform.cs
@@ -6,6 +6,7 @@ namespace Xamarin.Forms
iOS,
Android,
WinPhone,
- Windows
+ Windows,
+ Tizen
}
-} \ No newline at end of file
+}