From 05ce435c3b58e53eeab04c672affdeeab75f3036 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期五, 15 十一月 2019 14:41:39 +0800
Subject: [PATCH] 2019.11.15-1

---
 ZigbeeApp/Shared/Common/DeviceUI.cs |   49 ++++++++++++++++++++++++++-----------------------
 1 files changed, 26 insertions(+), 23 deletions(-)

diff --git a/ZigbeeApp/Shared/Common/DeviceUI.cs b/ZigbeeApp/Shared/Common/DeviceUI.cs
old mode 100755
new mode 100644
index fa24c33..5b31c90
--- a/ZigbeeApp/Shared/Common/DeviceUI.cs
+++ b/ZigbeeApp/Shared/Common/DeviceUI.cs
@@ -178,38 +178,38 @@
             {
                 case DeviceType.OnOffSwitch:
                     //鎺у埗闈㈡澘
-                    ImagePath= "Device/DryContact.png";
+                    ImagePath = "Device/DryContact.png";
                     break;
                 case DeviceType.OnOffOutput:
                     //缁х數鍣�
-                    ImagePath= "Device/Relay.png";
+                    ImagePath = "Device/Relay.png";
                     break;
                 case DeviceType.DimmableLight:
                     //璋冨厜鐏�
-                    ImagePath= "Device/DimmableLight.png";
+                    ImagePath = "Device/DimmableLight.png";
                     break;
                 case DeviceType.WindowCoveringDevice:
                     //绐楀笜
-                    ImagePath= "Device/Curtain.png";
+                    ImagePath = "Device/Curtain.png";
                     break;
                 case DeviceType.Thermostat:
                     //绌鸿皟
-                    ImagePath= "Device/AirConditioner.png";
+                    ImagePath = "Device/AirConditioner.png";
                     break;
                 case DeviceType.IASZone:
                     //浼犳劅鍣�
-                    ImagePath= "Device/Sensor.png";
+                    ImagePath = "Device/Sensor.png";
                     break;
                 case DeviceType.AirSwitch:
                     //绌烘皵寮�鍏�
-                    ImagePath= "Device/AirSwitch.png";
+                    ImagePath = "Device/AirSwitch.png";
                     break;
                 case DeviceType.Repeater:
                     //涓户鍣�
                     ImagePath = "Device/AirSwitch.png";
                     break;
                 default:
-                    ImagePath= "Device/Relay.png";
+                    ImagePath = "Device/Relay.png";
                     break;
             }
             return ImagePath;
@@ -304,6 +304,11 @@
                     //涓户鍣�
                     deviceTypeR = R.MyInternationalizationString.Repeater;
                     break;
+                case DeviceType.DoorLock:
+                    //闂ㄩ攣
+                    deviceTypeR = R.MyInternationalizationString.DoorLock;
+                    break;
+
                 default:
                     deviceTypeR = R.MyInternationalizationString.UnknowDevice;
                     break;
@@ -342,39 +347,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 +435,7 @@
                 {
                     return $"{model},{wind}";
                 }
-                else
-                {
-                    return $"{model},{wind},{tempareture}";
-                }
+                return $"{model},{wind},{tempareture}";
             }
             else
             {

--
Gitblit v1.8.0