From 06978e3b15b8536e2d4511ae4612fec1d556e145 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期四, 07 十一月 2019 11:19:56 +0800
Subject: [PATCH] 合并了全部的代码,IOS 图片需要从新引入工程

---
 ZigbeeApp/Shared/Common/DeviceUI.cs |  131 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 129 insertions(+), 2 deletions(-)

diff --git a/ZigbeeApp/Shared/Common/DeviceUI.cs b/ZigbeeApp/Shared/Common/DeviceUI.cs
index c91f9ec..fa24c33 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";
             }
         }
 
@@ -312,5 +312,132 @@
         }
 
         #endregion
+
+        #region 鈼� 閫氳繃id鑾峰彇璁惧鍖哄煙_____________
+
+        /// <summary>
+        /// GetZone
+        /// </summary>
+        /// <returns></returns>
+        public string GetZone()
+        {
+            var room = Room.CurrentRoom.GetRoomByDevice(CommonDevice);
+            if (room == null)
+            {
+                return Language.StringByID(R.MyInternationalizationString.UnallocatedArea);
+            }
+            var floorName = Config.Instance.Home.GetFloorNameById(room.FloorId);
+            if (floorName == null)
+            {
+                return room.Name;
+            }
+            return $"{floorName},{room.Name}";
+        }
+
+        #endregion
+
+        /// <summary>
+        /// GetDeviceStatu
+        /// </summary>
+        /// <returns></returns>
+        public string GetDeviceStatu()
+        {
+            if (CommonDevice.Type == DeviceType.OnOffOutput)
+            {
+                if ((CommonDevice as ToggleLight).OnOffStatus == 1)
+                {
+                    return Language.StringByID(R.MyInternationalizationString.Open);
+                }
+                return Language.StringByID(R.MyInternationalizationString.Shut);
+            }
+            else if (CommonDevice.Type == DeviceType.AirSwitch)
+            {
+                if ((CommonDevice as ZigBee.Device.AirSwitch).OnOffStatus == 1)
+                {
+                    return Language.StringByID(R.MyInternationalizationString.Open);
+                }
+                return Language.StringByID(R.MyInternationalizationString.Shut);
+            }
+            else if (CommonDevice.Type == DeviceType.DimmableLight)
+            {
+                if ((CommonDevice as DimmableLight).OnOffStatus == 0 || (CommonDevice as DimmableLight).Level == 0)
+                {
+                    return Language.StringByID(R.MyInternationalizationString.Shut);
+                }
+                return $"{(int)((CommonDevice as DimmableLight).Level * 1.0 / 254 * 100)}%";
+            }
+            else if (CommonDevice.Type == DeviceType.WindowCoveringDevice)
+            {
+                if ((CommonDevice as Rollershade).WcdCurrentPositionLiftPercentage == 0)
+                {
+                    return Language.StringByID(R.MyInternationalizationString.Shut);
+                }
+                return $"{(CommonDevice as Rollershade).WcdCurrentPositionLiftPercentage}%";
+            }
+            else if (CommonDevice.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}";
+                }
+                else
+                {
+                    return $"{model},{wind},{tempareture}";
+                }
+            }
+            else
+            {
+                return null;
+            }
+        }
     }
 }

--
Gitblit v1.8.0