From d6fb0646531172f23648441c224cdcccd721b894 Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期一, 14 十二月 2020 09:59:01 +0800
Subject: [PATCH] 请合并代码,完成晾衣架最终功能。

---
 ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/Base/DeviceRowCommon.cs |  101 ++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 93 insertions(+), 8 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/Base/DeviceRowCommon.cs b/ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/Base/DeviceRowCommon.cs
old mode 100755
new mode 100644
index 38c1f5b..4867f2d
--- a/ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/Base/DeviceRowCommon.cs
+++ b/ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/Base/DeviceRowCommon.cs
@@ -46,6 +46,10 @@
         /// </summary>
         private MostRightIconControl btnSwitch = null;
         /// <summary>
+        /// 鐢垫睜鎺т欢
+        /// </summary>
+        private IconViewControl btnBattery = null;
+        /// <summary>
         /// 鏄惁鑾峰彇缃戝叧鍙嶉鐨勭粨鏋�  0:娌℃湁鑾峰彇寰楀埌  1:宸茬粡鑾峰彇寰楀埌
         /// </summary>
         private int ResponeResult = 0;
@@ -111,11 +115,20 @@
             }
             btnDeviceName.X = Application.GetRealWidth(181);
             //褰撴寚瀹氬疄闄呭潗鏍囨椂,杩欓噷闇�瑕佺殑鍋忕Щ閲忎负2鍊�
-            btnDeviceName.Y = Application.GetRealHeight(16) + this.chidrenYaxis * 2;
-            btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceEpointName(i_device);
+            btnDeviceName.Y = Application.GetRealHeight(16) + this.chidrenYaxis * 2;
+
+            //鏅捐。鏋舵樉绀烘ā鍧楀悕瀛楋紙Mac鍚嶅瓧锛� 
+            if (this.device.Type == DeviceType.Airer)
+            {
+                btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceMacName(i_device);
+            }
+            else
+            {
+                btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceEpointName(i_device);
+            }
             btnDeviceName.SelectedTextColor = Common.ZigbeeColor.Current.GXCTextSelectedColor;
-            this.frameTable.AddChidren(btnDeviceName, ChidrenBindMode.BindEvent);
-            
+            this.frameTable.AddChidren(btnDeviceName, ChidrenBindMode.BindEvent);
+
             if (this.hadStatuFunction == false)
             {
                 //娌℃湁鐘舵�佸姛鑳�,鍒欐妸璁惧鍚嶅瓧鎺т欢涓�
@@ -146,6 +159,24 @@
             this.btnSwitch = new MostRightIconControl(69, 69);
             btnSwitch.UnSelectedImagePath = "Item/Switch.png";
             btnSwitch.SelectedImagePath = "Item/SwitchSelected.png";
+
+            //鐢垫睜鎺т欢
+            if (this.device.Type == DeviceType.IASZone)
+            {
+                this.btnBattery = new IconViewControl(69);
+                btnBattery.X = this.Width - Application.GetRealWidth(69 + 29);
+                btnBattery.UnSelectedImagePath = "Item/Battery.png";
+                btnBattery.Gravity = Gravity.CenterVertical;
+                this.frameTable.AddChidren(btnBattery, ChidrenBindMode.BindEvent);
+                if (chidrenYaxis != 0)
+                {
+                    btnBattery.Y += chidrenYaxis;
+                }
+                if (this.device.IsBatteryDown == false)
+                {
+                    btnBattery.Visible = false;
+                }
+            }
 
             //鍒嗕韩鐨勬埧闂�,鍒欎笉鑳界紪杈戝拰鍒犻櫎
             if (this.nowSelectRoom.IsSharedRoom == false)
@@ -202,6 +233,8 @@
                         //鍥炶皟鎺т欢琚Щ闄ょ殑浜嬩欢
                         this.RowNeedRemoveEvent?.Invoke();
                         this.RemoveFromParent();
+                        //涓婁紶绌洪棿鍖哄煙淇℃伅
+                        HdlRoomLogic.Current.SetRoomInfoToGateway();
                     };
                 };
             }
@@ -240,7 +273,15 @@
             //璁惧鍥炬爣涔熷埛鏂�
             Common.LocalDevice.Current.SetDeviceIconToControl(btnDeviceIcon, i_device);
             //璁惧鍚嶅瓧
-            this.btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceEpointName(i_device);
+            //鏅捐。鏋舵樉绀烘ā鍧楀悕瀛楋紙Mac鍚嶅瓧锛� 
+            if (this.device.Type == DeviceType.Airer)
+            {
+                this.btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceMacName(i_device);
+            }
+            else
+            {
+                this.btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceEpointName(i_device);
+            }
             //妫�娴嬭澶囨槸鍚︽槸鎵撳紑鐘舵��
             bool isOpen = this.CheckIsOpenStatu(i_device);
             if (this.isHadOpenSwitch == true && i_device.HadReadDeviceStatu == false)
@@ -249,6 +290,13 @@
                 //绛夊緟缃戝叧鍥炲鍚庝細閲嶆柊鍒锋柊,涓嶇劧涓�鐩存槸鍏抽棴鐘舵��
                 isOpen = false;
             }
+            //濡傛灉鏄紶鎰熷櫒绫�,鍒欓粯璁ゆ槸鍏崇殑鏁堟灉
+            if (this.device.Type == DeviceType.PMSensor || this.device.Type == DeviceType.IASZone
+                || this.device.Type == DeviceType.TemperatureSensor)
+            {
+                isOpen = false;
+            }
+
             this.SetRowOpenStatu(isOpen);
         }
 
@@ -351,8 +399,8 @@
                 }
             }
             else
-            {   
-                //濡傛灉杩欎釜璁惧鏀瑰彉浜嗘埧闂寸殑璇�,鍥炶皟鍗$墖琚垹闄ょ殑鍑芥暟
+            {
+                //濡傛灉杩欎釜璁惧鏀瑰彉浜嗘埧闂寸殑璇�,鍥炶皟鍗$墖琚垹闄ょ殑鍑芥暟
                 var nowRoom = HdlRoomLogic.Current.GetRoomByDevice(device);
                 if (nowRoom == null || nowRoom.Id != this.nowSelectRoom.Id)
                 {
@@ -419,6 +467,43 @@
         public void SetHadGetResponeResultStatu()
         {
             this.ResponeResult = 1;
+        }
+
+        /// <summary>
+        /// 鎺ユ敹缃戝叧鍥炲鐨勭姸鎬�(true:宸茬粡鎺ユ敹鍒扮綉鍏崇殑鍥炲 false:杩樻病鏈夋帴鏀跺埌缃戝叧鍥炲)
+        /// </summary>
+        /// <returns></returns>
+        public bool ReceiveResponeResultStatu()
+        {
+            return this.ResponeResult == 1;
+        }
+
+        #endregion
+
+        #region 鈻� 鏄剧ず浣庣數閲廮________________________
+
+        /// <summary>
+        /// 鍒锋柊鐢垫睜鐢甸噺鐘舵��
+        /// </summary>
+        public void RefreshBatteryStatu()
+        {
+            if (this.btnBattery == null) { return; }
+            if (this.device.IsBatteryDown == true)
+            {
+                //鐢甸噺浣�,鏄剧ず鍥炬爣
+                if (this.btnBattery.Visible == false)
+                {
+                    this.btnBattery.Visible = true;
+                }
+            }
+            else
+            {
+                //鐢甸噺瓒冲,闅愯棌鍥炬爣
+                if (this.btnBattery.Visible == true)
+                {
+                    this.btnBattery.Visible = false;
+                }
+            }
         }
 
         #endregion
@@ -495,7 +580,7 @@
         /// <summary>
         /// 鍒囨崲鍗$墖鐘舵�佺壒鏁�
         /// </summary>
-        private void SwitchRowStatuAppeal(bool isOpen)
+        public void SwitchRowStatuAppeal(bool isOpen)
         {
             if (this.btnDeviceName.IsSelected == isOpen)
             {

--
Gitblit v1.8.0