From 5727cf0b9b54da0a191dd1e23cb5abf21320fbff Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期一, 25 十一月 2019 10:34:17 +0800
Subject: [PATCH] IOS使用新的项目名称

---
 ZigbeeApp/Shared/Common/DeviceUI.cs |  110 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 106 insertions(+), 4 deletions(-)

diff --git a/ZigbeeApp/Shared/Common/DeviceUI.cs b/ZigbeeApp/Shared/Common/DeviceUI.cs
index 01b042b..4b279ac 100755
--- a/ZigbeeApp/Shared/Common/DeviceUI.cs
+++ b/ZigbeeApp/Shared/Common/DeviceUI.cs
@@ -35,9 +35,9 @@
                 var myDevice = Common.LocalDevice.Current.GetDevice(DeviceAddr, DeviceEpoint);
                 if (myDevice != null)
                 {
-                    return $"DeviceUI_{myDevice.FilePath}";
+                    return myDevice.FilePath;
                 }
-                return $"DeviceUI_Unkwon";
+                return $"Device_Unkwon";
             }
         }
 
@@ -324,9 +324,9 @@
             var room = Room.CurrentRoom.GetRoomByDevice(CommonDevice);
             if (room == null)
             {
-                return null;
+                return Language.StringByID(R.MyInternationalizationString.UnallocatedArea);
             }
-            var floorName = Shared.Common.Config.Instance.Home.GetFloorNameById(room.FloorId);
+            var floorName = Config.Instance.Home.GetFloorNameById(room.FloorId);
             if (floorName == null)
             {
                 return room.Name;
@@ -335,5 +335,107 @@
         }
 
         #endregion
+
+        /// <summary>
+        /// GetDeviceStatu
+        /// </summary>
+        /// <returns></returns>
+        public string GetDeviceStatu()
+        {
+            var device = CommonDevice;
+            if (device.Type == DeviceType.OnOffOutput)
+            {
+                if ((device as ToggleLight).OnOffStatus == 1)
+                {
+                    return Language.StringByID(R.MyInternationalizationString.Open);
+                }
+                return Language.StringByID(R.MyInternationalizationString.Shut);
+            }
+            else if (device.Type == DeviceType.AirSwitch)
+            {
+                if ((device as ZigBee.Device.AirSwitch).OnOffStatus == 1)
+                {
+                    return Language.StringByID(R.MyInternationalizationString.Open);
+                }
+                return Language.StringByID(R.MyInternationalizationString.Shut);
+            }
+            else if (device.Type == DeviceType.DimmableLight)
+            {
+                if ((device as DimmableLight).OnOffStatus == 0 || (device as DimmableLight).Level == 0)
+                {
+                    return Language.StringByID(R.MyInternationalizationString.Shut);
+                }
+                return $"{(int)((device as DimmableLight).Level * 1.0 / 254 * 100)}%";
+            }
+            else if (device.Type == DeviceType.WindowCoveringDevice)
+            {
+                if ((device as Rollershade).WcdCurrentPositionLiftPercentage == 0)
+                {
+                    return Language.StringByID(R.MyInternationalizationString.Shut);
+                }
+                return $"{(device as Rollershade).WcdCurrentPositionLiftPercentage}%";
+            }
+            else if (device.Type == DeviceType.Thermostat)
+            {
+                //娓╁害锛屾ā寮忥紝椋庨��
+                string tempareture = string.Empty;
+                string model = string.Empty;
+                string wind = string.Empty;
+
+                var ac = CommonDevice as AC;
+
+                if (ac.currentSystemMode == 0)
+                {
+                    return Language.StringByID(R.MyInternationalizationString.Shut);
+                }
+                else if (ac.currentSystemMode == 1)
+                {
+                    model = Language.StringByID(R.MyInternationalizationString.Mode_Auto);
+                    tempareture = $"{ac.currentCoolingSetpoint} 鈩�";
+                }
+                else if (ac.currentSystemMode == 3)
+                {
+                    model = Language.StringByID(R.MyInternationalizationString.Mode_Cool);
+                    tempareture = $"{ac.currentCoolingSetpoint} 鈩�";
+                }
+                else if (ac.currentSystemMode == 4)
+                {
+                    model = Language.StringByID(R.MyInternationalizationString.Mode_Heat);
+                    tempareture = $"{ac.currentHeatingSetpoint} 鈩�";
+                }
+                else if (ac.currentSystemMode == 7)
+                {
+                    model = Language.StringByID(R.MyInternationalizationString.Mode_FanOnly);
+                }
+                else if (ac.currentSystemMode == 8)
+                {
+                    model = Language.StringByID(R.MyInternationalizationString.Mode_Dry);
+                    tempareture = $"{ac.currentCoolingSetpoint} 鈩�";
+                }
+
+                if (ac.currentFanMode == 1)
+                {
+                    wind = Language.StringByID(R.MyInternationalizationString.Fan_Low);
+                }
+                else if (ac.currentFanMode == 2)
+                {
+                    wind = Language.StringByID(R.MyInternationalizationString.Fan_Middle);
+                }
+                else
+                {
+                    wind = Language.StringByID(R.MyInternationalizationString.Fan_Height);
+                }
+
+                if (string.IsNullOrEmpty(tempareture))
+                {
+                    return $"{model},{wind}";
+                }
+                return $"{model},{wind},{tempareture}";
+            }
+            else
+            {
+                return null;
+            }
+        }
     }
 }

--
Gitblit v1.8.0