summaryrefslogtreecommitdiff
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
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
-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
-rw-r--r--docs/Xamarin.Forms.Core/Xamarin.Forms.PlatformConfiguration/Tizen.xml35
-rw-r--r--docs/Xamarin.Forms.Core/Xamarin.Forms/Device.xml73
-rw-r--r--docs/Xamarin.Forms.Core/Xamarin.Forms/OnPlatform`1.xml16
-rw-r--r--docs/Xamarin.Forms.Core/Xamarin.Forms/TargetPlatform.xml14
-rw-r--r--docs/Xamarin.Forms.Core/index.xml1
9 files changed, 175 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
+}
diff --git a/docs/Xamarin.Forms.Core/Xamarin.Forms.PlatformConfiguration/Tizen.xml b/docs/Xamarin.Forms.Core/Xamarin.Forms.PlatformConfiguration/Tizen.xml
new file mode 100644
index 0000000..de0e8fa
--- /dev/null
+++ b/docs/Xamarin.Forms.Core/Xamarin.Forms.PlatformConfiguration/Tizen.xml
@@ -0,0 +1,35 @@
+<Type Name="Tizen" FullName="Xamarin.Forms.PlatformConfiguration.Tizen">
+ <TypeSignature Language="C#" Value="public sealed class Tizen : Xamarin.Forms.IConfigPlatform" />
+ <TypeSignature Language="ILAsm" Value=".class public auto ansi sealed beforefieldinit Tizen extends System.Object implements class Xamarin.Forms.IConfigPlatform" />
+ <AssemblyInfo>
+ <AssemblyName>Xamarin.Forms.Core</AssemblyName>
+ <AssemblyVersion>2.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <Base>
+ <BaseTypeName>System.Object</BaseTypeName>
+ </Base>
+ <Interfaces>
+ <Interface>
+ <InterfaceName>Xamarin.Forms.IConfigPlatform</InterfaceName>
+ </Interface>
+ </Interfaces>
+ <Docs>
+ <summary>To be added.</summary>
+ <remarks>To be added.</remarks>
+ </Docs>
+ <Members>
+ <Member MemberName=".ctor">
+ <MemberSignature Language="C#" Value="public Tizen ();" />
+ <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
+ <MemberType>Constructor</MemberType>
+ <AssemblyInfo>
+ <AssemblyVersion>2.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <Parameters />
+ <Docs>
+ <summary>To be added.</summary>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
+ </Members>
+</Type>
diff --git a/docs/Xamarin.Forms.Core/Xamarin.Forms/Device.xml b/docs/Xamarin.Forms.Core/Xamarin.Forms/Device.xml
index d5c3fce..1c68026 100644
--- a/docs/Xamarin.Forms.Core/Xamarin.Forms/Device.xml
+++ b/docs/Xamarin.Forms.Core/Xamarin.Forms/Device.xml
@@ -168,6 +168,41 @@ Device.OnPlatform (iOS: () => label.Font = Font.OfSize ("HelveticaNeue-UltraLigh
</remarks>
</Docs>
</Member>
+ <Member MemberName="OnPlatform">
+ <MemberSignature Language="C#" Value="public static void OnPlatform (Action iOS = null, Action Android = null, Action WinPhone = null, Action Default = null, Action Tizen = null);" />
+ <MemberSignature Language="ILAsm" Value=".method public static hidebysig void OnPlatform(class System.Action iOS, class System.Action Android, class System.Action WinPhone, class System.Action Default, class System.Action Tizen) cil managed" />
+ <MemberType>Method</MemberType>
+ <AssemblyInfo>
+ <AssemblyVersion>2.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <ReturnValue>
+ <ReturnType>System.Void</ReturnType>
+ </ReturnValue>
+ <Parameters>
+ <Parameter Name="iOS" Type="System.Action" />
+ <Parameter Name="Android" Type="System.Action" />
+ <Parameter Name="WinPhone" Type="System.Action" />
+ <Parameter Name="Default" Type="System.Action" />
+ <Parameter Name="Tizen" Type="System.Action" />
+ </Parameters>
+ <Docs>
+ <param name="iOS">(optional) The Action to execute on iOS.</param>
+ <param name="Android">(optional) The Action to execute on Android.</param>
+ <param name="WinPhone">(optional) The Action to execute on WinPhone.</param>
+ <param name="Default">(optional) The Action to execute if no Action was provided for the current OS.</param>
+ <param name="Tizen">(optional) The Action to execute on Tizen.</param>
+ <summary>Executes different Actions depending on the <see cref="T:Xamarin.QcuikUI.TargetOS" /> that Xamarin.Forms is working on.</summary>
+ <remarks>
+ <para>This example shows how to change the font of a Label on a single OS.
+ </para>
+ <example>
+ <code lang="C#"><![CDATA[
+Device.OnPlatform (iOS: () => label.Font = Font.OfSize ("HelveticaNeue-UltraLight", NamedSize.Large));
+ ]]></code>
+ </example>
+ </remarks>
+ </Docs>
+ </Member>
<Member MemberName="OnPlatform&lt;T&gt;">
<MemberSignature Language="C#" Value="public static T OnPlatform&lt;T&gt; (T iOS, T Android, T WinPhone);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig !!T OnPlatform&lt;T&gt;(!!T iOS, !!T Android, !!T WinPhone) cil managed" />
@@ -210,6 +245,44 @@ button.HeightRequest = Device.OnPlatform (20,30,30);
</remarks>
</Docs>
</Member>
+ <Member MemberName="OnPlatform&lt;T&gt;">
+ <MemberSignature Language="C#" Value="public static T OnPlatform&lt;T&gt; (T iOS, T Android, T WinPhone, T Tizen);" />
+ <MemberSignature Language="ILAsm" Value=".method public static hidebysig !!T OnPlatform&lt;T&gt;(!!T iOS, !!T Android, !!T WinPhone, !!T Tizen) cil managed" />
+ <MemberType>Method</MemberType>
+ <AssemblyInfo>
+ <AssemblyVersion>2.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <ReturnValue>
+ <ReturnType>T</ReturnType>
+ </ReturnValue>
+ <TypeParameters>
+ <TypeParameter Name="T" />
+ </TypeParameters>
+ <Parameters>
+ <Parameter Name="iOS" Type="T" />
+ <Parameter Name="Android" Type="T" />
+ <Parameter Name="WinPhone" Type="T" />
+ <Parameter Name="Tizen" Type="T" />
+ </Parameters>
+ <Docs>
+ <typeparam name="T">The type of the value to be returned.</typeparam>
+ <param name="iOS">The value for iOS.</param>
+ <param name="Android">The value for Android.</param>
+ <param name="WinPhone">The value for WinPhone.</param>
+ <param name="WinPhone">The value for Tizen.</param>
+ <summary>Returns different values depending on the <see cref="T:Xamarin.Forms.TargetOS" /> Xamarin.Forms is working on.</summary>
+ <returns>The value for the current OS.</returns>
+ <remarks>
+ <para>This example shows how to use different heights for a Button on different OS.
+ </para>
+ <example>
+ <code lang="C#"><![CDATA[
+button.HeightRequest = Device.OnPlatform (20,30,30);
+ ]]></code>
+ </example>
+ </remarks>
+ </Docs>
+ </Member>
<Member MemberName="OpenUri">
<MemberSignature Language="C#" Value="public static void OpenUri (Uri uri);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void OpenUri(class System.Uri uri) cil managed" />
diff --git a/docs/Xamarin.Forms.Core/Xamarin.Forms/OnPlatform`1.xml b/docs/Xamarin.Forms.Core/Xamarin.Forms/OnPlatform`1.xml
index 3871487..1204cff 100644
--- a/docs/Xamarin.Forms.Core/Xamarin.Forms/OnPlatform`1.xml
+++ b/docs/Xamarin.Forms.Core/Xamarin.Forms/OnPlatform`1.xml
@@ -113,6 +113,22 @@
<remarks>To be added.</remarks>
</Docs>
</Member>
+ <Member MemberName="Tizen">
+ <MemberSignature Language="C#" Value="public T Tizen { get; set; }" />
+ <MemberSignature Language="ILAsm" Value=".property instance !T Tizen" />
+ <MemberType>Property</MemberType>
+ <AssemblyInfo>
+ <AssemblyVersion>2.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <ReturnValue>
+ <ReturnType>T</ReturnType>
+ </ReturnValue>
+ <Docs>
+ <summary>The type as it is implemented on the Tizen platform.</summary>
+ <value>To be added.</value>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
<Member MemberName="WinPhone">
<MemberSignature Language="C#" Value="public T WinPhone { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance !T WinPhone" />
diff --git a/docs/Xamarin.Forms.Core/Xamarin.Forms/TargetPlatform.xml b/docs/Xamarin.Forms.Core/Xamarin.Forms/TargetPlatform.xml
index 40fd72b..9dc4466 100644
--- a/docs/Xamarin.Forms.Core/Xamarin.Forms/TargetPlatform.xml
+++ b/docs/Xamarin.Forms.Core/Xamarin.Forms/TargetPlatform.xml
@@ -80,6 +80,20 @@
<summary>(Unused) Indicates that Forms is running on an undefined platform.</summary>
</Docs>
</Member>
+ <Member MemberName="Tizen">
+ <MemberSignature Language="C#" Value="Tizen" />
+ <MemberSignature Language="ILAsm" Value=".field public static literal valuetype Xamarin.Forms.TargetPlatform Tizen = int32(5)" />
+ <MemberType>Field</MemberType>
+ <AssemblyInfo>
+ <AssemblyVersion>2.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <ReturnValue>
+ <ReturnType>Xamarin.Forms.TargetPlatform</ReturnType>
+ </ReturnValue>
+ <Docs>
+ <summary>Indicates that forms is running on the Tizen platform.</summary>
+ </Docs>
+ </Member>
<Member MemberName="Windows">
<MemberSignature Language="C#" Value="Windows" />
<MemberSignature Language="ILAsm" Value=".field public static literal valuetype Xamarin.Forms.TargetPlatform Windows = int32(4)" />
diff --git a/docs/Xamarin.Forms.Core/index.xml b/docs/Xamarin.Forms.Core/index.xml
index f13fd56..901945f 100644
--- a/docs/Xamarin.Forms.Core/index.xml
+++ b/docs/Xamarin.Forms.Core/index.xml
@@ -460,6 +460,7 @@
<Namespace Name="Xamarin.Forms.PlatformConfiguration">
<Type Name="Android" Kind="Class" />
<Type Name="iOS" Kind="Class" />
+ <Type Name="Tizen" Kind="Class" />
<Type Name="Windows" Kind="Class" />
</Namespace>
<Namespace Name="Xamarin.Forms.PlatformConfiguration.AndroidSpecific">