From 8b9ce384b26c414db32f98e94e088f5334869c2d Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期三, 13 十一月 2019 15:36:28 +0800
Subject: [PATCH] 全部合并了代码,安卓和 IOS 都测试通过了

---
 ZigbeeApp/Shared/Common/DeviceUI.cs |   28 +++++++++++++---------------
 1 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/ZigbeeApp/Shared/Common/DeviceUI.cs b/ZigbeeApp/Shared/Common/DeviceUI.cs
index fa24c33..4b279ac 100755
--- a/ZigbeeApp/Shared/Common/DeviceUI.cs
+++ b/ZigbeeApp/Shared/Common/DeviceUI.cs
@@ -342,39 +342,40 @@
         /// <returns></returns>
         public string GetDeviceStatu()
         {
-            if (CommonDevice.Type == DeviceType.OnOffOutput)
+            var device = CommonDevice;
+            if (device.Type == DeviceType.OnOffOutput)
             {
-                if ((CommonDevice as ToggleLight).OnOffStatus == 1)
+                if ((device as ToggleLight).OnOffStatus == 1)
                 {
                     return Language.StringByID(R.MyInternationalizationString.Open);
                 }
                 return Language.StringByID(R.MyInternationalizationString.Shut);
             }
-            else if (CommonDevice.Type == DeviceType.AirSwitch)
+            else if (device.Type == DeviceType.AirSwitch)
             {
-                if ((CommonDevice as ZigBee.Device.AirSwitch).OnOffStatus == 1)
+                if ((device as ZigBee.Device.AirSwitch).OnOffStatus == 1)
                 {
                     return Language.StringByID(R.MyInternationalizationString.Open);
                 }
                 return Language.StringByID(R.MyInternationalizationString.Shut);
             }
-            else if (CommonDevice.Type == DeviceType.DimmableLight)
+            else if (device.Type == DeviceType.DimmableLight)
             {
-                if ((CommonDevice as DimmableLight).OnOffStatus == 0 || (CommonDevice as DimmableLight).Level == 0)
+                if ((device as DimmableLight).OnOffStatus == 0 || (device as DimmableLight).Level == 0)
                 {
                     return Language.StringByID(R.MyInternationalizationString.Shut);
                 }
-                return $"{(int)((CommonDevice as DimmableLight).Level * 1.0 / 254 * 100)}%";
+                return $"{(int)((device as DimmableLight).Level * 1.0 / 254 * 100)}%";
             }
-            else if (CommonDevice.Type == DeviceType.WindowCoveringDevice)
+            else if (device.Type == DeviceType.WindowCoveringDevice)
             {
-                if ((CommonDevice as Rollershade).WcdCurrentPositionLiftPercentage == 0)
+                if ((device as Rollershade).WcdCurrentPositionLiftPercentage == 0)
                 {
                     return Language.StringByID(R.MyInternationalizationString.Shut);
                 }
-                return $"{(CommonDevice as Rollershade).WcdCurrentPositionLiftPercentage}%";
+                return $"{(device as Rollershade).WcdCurrentPositionLiftPercentage}%";
             }
-            else if (CommonDevice.Type == DeviceType.Thermostat)
+            else if (device.Type == DeviceType.Thermostat)
             {
                 //娓╁害锛屾ā寮忥紝椋庨��
                 string tempareture = string.Empty;
@@ -429,10 +430,7 @@
                 {
                     return $"{model},{wind}";
                 }
-                else
-                {
-                    return $"{model},{wind},{tempareture}";
-                }
+                return $"{model},{wind},{tempareture}";
             }
             else
             {

--
Gitblit v1.8.0