From e96e11d6f8b965ea522c983e040d41e3b9ef105a Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期一, 18 五月 2020 21:33:19 +0800
Subject: [PATCH] 2020-05-18-4

---
 ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/Base/DeviceRowCommon.cs |   48 ++++++++++++++++++++++++++++--------------------
 1 files changed, 28 insertions(+), 20 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/Base/DeviceRowCommon.cs b/ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/Base/DeviceRowCommon.cs
index 89f1059..2789bd2 100755
--- a/ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/Base/DeviceRowCommon.cs
+++ b/ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/Base/DeviceRowCommon.cs
@@ -61,8 +61,7 @@
         /// <summary>
         /// 鏈垎閰嶇晫闈㈢殑璁惧閫夋嫨鎺т欢
         /// </summary>
-        /// <param name="i_ChidrenYaxis">瀛愭帶浠禮杞村亸绉婚噺(鐪熷疄鍊�,鏈変簺鐣岄潰闇�瑕佽繖绉嶇壒娈婃搷浣�)</param>
-        public DeviceRowCommon(int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis)
+        public DeviceRowCommon()
         {
             this.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft);
             this.Width = Application.GetRealWidth(1022);
@@ -77,11 +76,11 @@
             this.device = i_device;
             //璁惧鍥炬爣鑳屾櫙鎺т欢
             this.frameIconBackGroud = new FrameLayout();
-            frameIconBackGroud.Height = Application.GetMinRealAverage(112);
-            frameIconBackGroud.Width = Application.GetMinRealAverage(112);
+            frameIconBackGroud.Height = this.GetPictrueRealSize(112);
+            frameIconBackGroud.Width = this.GetPictrueRealSize(112);
             frameIconBackGroud.Gravity = Gravity.CenterVertical;
             frameIconBackGroud.X = Application.GetRealWidth(46);
-            frameIconBackGroud.Radius = (uint)Application.GetMinRealAverage(112 / 2);
+            frameIconBackGroud.Radius = (uint)this.GetPictrueRealSize(112 / 2);
             frameIconBackGroud.BackgroundColor = Common.ZigbeeColor.Current.GXCGrayBackgroundColor;
             this.frameTable.AddChidren(frameIconBackGroud, ChidrenBindMode.NotBind);
             if (chidrenYaxis != 0)
@@ -100,7 +99,8 @@
             //璁惧鍚嶅瓧
             this.btnDeviceName = new NormalViewControl(600, 60, true);
             btnDeviceName.X = Application.GetRealWidth(181);
-            btnDeviceName.Y = Application.GetRealHeight(16) + this.chidrenYaxis;
+            //褰撴寚瀹氬疄闄呭潗鏍囨椂,杩欓噷闇�瑕佺殑鍋忕Щ閲忎负2鍊�
+            btnDeviceName.Y = Application.GetRealHeight(16) + this.chidrenYaxis * 2;
             btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceEpointName(i_device);
             btnDeviceName.SelectedTextColor = Common.ZigbeeColor.Current.GXCTextSelectedColor;
             this.frameTable.AddChidren(btnDeviceName, ChidrenBindMode.BindEventOnly);
@@ -109,6 +109,7 @@
             {
                 //娌℃湁鐘舵�佸姛鑳�,鍒欐妸璁惧鍚嶅瓧鎺т欢涓�
                 this.btnDeviceName.Gravity = Gravity.CenterVertical;
+                btnDeviceName.Y += this.chidrenYaxis;
             }
             //鎷ユ湁鐘舵�佸姛鑳�
             if (this.hadStatuFunction == true)
@@ -116,7 +117,8 @@
                 //鐘舵��
                 this.btnStatu = new NormalViewControl(600, 50, true);
                 btnStatu.X = Application.GetRealWidth(181);
-                btnStatu.Y = Application.GetRealHeight(70) + this.chidrenYaxis;
+                //褰撴寚瀹氬疄闄呭潗鏍囨椂,杩欓噷闇�瑕佺殑鍋忕Щ閲忎负2鍊�
+                btnStatu.Y = Application.GetRealHeight(70) + this.chidrenYaxis * 2;
                 btnStatu.TextSize = 10;
                 btnStatu.TextColor = UserCenterColor.Current.TextGrayColor1;
                 this.frameTable.AddChidren(btnStatu, ChidrenBindMode.BindEventOnly);
@@ -141,32 +143,28 @@
                 var btnEditor = this.AddEditorControl();
                 btnEditor.ButtonClickEvent += (sender, e) =>
                 {
-                    //鍏抽棴宸︽粦鑿滃崟
-                    this.HideMenu();
-                    var detailInfo = new Device.CommonForm.DeviceDetailInfo { };
-                    UserView.HomePage.Instance.AddChidren(detailInfo);
-                    UserView.HomePage.Instance.PageIndex += 1;
-                    detailInfo.Show(i_device, HdlRoomLogic.Current.CurrentRoom);
-                    detailInfo.EditAction += (curDevice, curRoom) =>
+                    var detailInfo = new MainPage.DeviceDetailInfoForm();
+                    detailInfo.AddForm(i_device, HdlRoomLogic.Current.CurrentRoom);
+                    detailInfo.FormCloseEvent += (curDevice, curRoom) =>
                     {
                         if (HdlRoomLogic.Current.CurrentRoom.IsLove == true)
                         {
                             //褰撳墠鏄枩鐖辨埧闂存椂
                             if (HdlRoomLogic.Current.IsCollectInRoom(this.device) == false)
                             {
-                                //鎴块棿鏀瑰彉浜�
-                                this.RemoveFromParent();
                                 //鍥炶皟鎺т欢琚Щ闄ょ殑浜嬩欢
                                 this.RowNeedRemoveEvent?.Invoke();
+                                //鎴块棿鏀瑰彉浜�
+                                this.RemoveFromParent();
                                 return;
                             }
                         }
                         else if (HdlRoomLogic.Current.CurrentRoom.Id != curRoom.Id)
                         {
-                            //鎴块棿鏀瑰彉浜�
-                            this.RemoveFromParent();
                             //鍥炶皟鎺т欢琚Щ闄ょ殑浜嬩欢
                             this.RowNeedRemoveEvent?.Invoke();
+                            //鎴块棿鏀瑰彉浜�
+                            this.RemoveFromParent();
                             return;
                         }
                         //鍒锋柊鎺т欢鐘舵��
@@ -189,9 +187,9 @@
                             //浠庢埧闂翠腑绉婚櫎
                             HdlRoomLogic.Current.DeleteDevice(i_device);
                         }
-                        this.RemoveFromParent();
                         //鍥炶皟鎺т欢琚Щ闄ょ殑浜嬩欢
                         this.RowNeedRemoveEvent?.Invoke();
+                        this.RemoveFromParent();
                     };
                 };
             }
@@ -233,6 +231,12 @@
             this.btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceEpointName(i_device);
             //妫�娴嬭澶囨槸鍚︽槸鎵撳紑鐘舵��
             bool isOpen = this.CheckIsOpenStatu(i_device);
+            if (this.isHadOpenSwitch == true && i_device.HadReadDeviceStatu == false)
+            {
+                //濡傛灉杩欎釜鍗$墖鏈夊紑鍏冲姛鑳�,骞朵笖缃戝叧杩樻病鏈夊洖澶嶄箣鍓�,榛樿鏄叧闂姸鎬�
+                //绛夊緟缃戝叧鍥炲鍚庝細閲嶆柊鍒锋柊,涓嶇劧涓�鐩存槸鍏抽棴鐘舵��
+                isOpen = false;
+            }
             this.SetRowOpenStatu(isOpen);
         }
 
@@ -326,7 +330,7 @@
             //濡傛灉杩欎釜鍑芥暟琚噸鍐欑殑璇�,鍒欎唬琛ㄨ繖涓澶囨湁寮�鍏冲姛鑳�
             this.isHadOpenSwitch = false;
             //榛樿鐢ㄥ湪绾跨姸鎬佹潵鍒ゆ柇
-            return i_device.IsOnline == 1;
+            return Common.LocalDevice.Current.CheckDeviceIsOnline(i_device);
         }
 
 
@@ -346,6 +350,8 @@
                 //宸茬粡鍙栨秷鐨勬敹钘�
                 if (HdlRoomLogic.Current.IsCollectInRoom(device) == false)
                 {
+                    //鍥炶皟鎺т欢琚Щ闄ょ殑浜嬩欢
+                    this.RowNeedRemoveEvent?.Invoke();
                     //绉婚櫎杩欎釜鎺т欢
                     this.RemoveFromParent();
                     return;
@@ -357,6 +363,8 @@
                 var nowRoom = HdlRoomLogic.Current.GetRoomByDevice(device);
                 if (nowRoom == null || nowRoom.Id != HdlRoomLogic.Current.CurrentRoom.Id)
                 {
+                    //鍥炶皟鎺т欢琚Щ闄ょ殑浜嬩欢
+                    this.RowNeedRemoveEvent?.Invoke();
                     //绉婚櫎杩欎釜鎺т欢
                     this.RemoveFromParent();
                     return;

--
Gitblit v1.8.0