Initialize DeviceInfo with system information
authorPawel Andruszkiewicz <p.andruszkie@samsung.com>
Tue, 3 Jan 2017 08:46:09 +0000 (09:46 +0100)
committerKangho Hur <kangho.hur@samsung.com>
Fri, 24 Mar 2017 04:18:58 +0000 (13:18 +0900)
Change-Id: Ia70b9ffec0f54b3d0440e448dfae41bc22c546c1
Signed-off-by: Pawel Andruszkiewicz <p.andruszkie@samsung.com>
Xamarin.Forms.Platform.Tizen/Forms.cs
Xamarin.Forms.Platform.Tizen/Xamarin.Forms.Platform.Tizen.project.json
packaging/xamarin-forms-tizen.spec

index f5989e0..34828a4 100644 (file)
@@ -5,6 +5,7 @@ using System.Linq.Expressions;
 using System.Reflection;
 using ElmSharp;
 using Tizen.Applications;
+using TSystemInfo = Tizen.System.SystemInfo;
 
 namespace Xamarin.Forms.Platform.Tizen
 {
@@ -44,10 +45,15 @@ namespace Xamarin.Forms.Platform.Tizen
 
                        public TizenDeviceInfo(FormsApplication formsApplication)
                        {
-                               // TODO: obtain screen data from device
-                               pixelScreenSize = new Size();
-                               scaledScreenSize = new Size();
-                               scalingFactor = 0.0;
+                               int width = 0;
+                               int height = 0;
+
+                               TSystemInfo.TryGetValue("http://tizen.org/feature/screen.width", out width);
+                               TSystemInfo.TryGetValue("http://tizen.org/feature/screen.height", out height);
+
+                               scalingFactor = 1.0;  // scaling is disabled, we're using pixels as Xamarin's geometry units
+                               pixelScreenSize = new Size(width, height);
+                               scaledScreenSize = new Size(width / scalingFactor, height / scalingFactor);
                        }
                }
 
index 02b62b9..1e97eea 100644 (file)
@@ -3,7 +3,8 @@
     "ElmSharp": "1.1.0-*",
     "NETStandard.Library": "1.6.0",
     "System.Runtime.Serialization.Xml": "4.1.1",
-    "Tizen.Applications": "1.0.2"
+    "Tizen.Applications": "1.0.2",
+    "Tizen.System": "1.0.5"
   },
   "frameworks": {
     "netstandard1.6": {
index 074629b..c0fc490 100644 (file)
@@ -38,6 +38,7 @@ BuildRequires: dotnet-build-tools
 # C# API Requires
 BuildRequires: csapi-tizen-nuget
 BuildRequires: csapi-application-nuget
+BuildRequires: csapi-system-nuget
 BuildRequires: elm-sharp-nuget
 
 %description