From 3f87bf0ae7394cdd7d52428f1f6b4361434c7cc4 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期五, 15 五月 2020 13:28:33 +0800
Subject: [PATCH] hhhhhhhhh

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

diff --git a/ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/Base/DeviceRowCommon.cs b/ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/Base/DeviceRowCommon.cs
index 2789bd2..737c569 100755
--- a/ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/Base/DeviceRowCommon.cs
+++ b/ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/Base/DeviceRowCommon.cs
@@ -53,6 +53,10 @@
         /// 鍒ゆ柇鏄惁鏈夊紑鍏冲姛鑳�
         /// </summary>
         private bool isHadOpenSwitch = true;
+        /// <summary>
+        /// 褰撳墠閫夋嫨鐨勬埧闂�
+        /// </summary>
+        public Common.Room nowSelectRoom = null;
 
         #endregion
 
@@ -71,9 +75,11 @@
         /// 鍒濆鍖栨帶浠�
         /// </summary>
         /// <param name="i_device">璁惧瀵硅薄</param>
-        public virtual void InitControl(CommonDevice i_device)
+        /// <param name="i_nowSelectRoom">褰撳墠閫夋嫨鐨勬埧闂�(鏈夌偣鐢ㄥ)</param>
+        public virtual void InitControl(CommonDevice i_device, Common.Room i_nowSelectRoom)
         {
             this.device = i_device;
+            this.nowSelectRoom = i_nowSelectRoom;
             //璁惧鍥炬爣鑳屾櫙鎺т欢
             this.frameIconBackGroud = new FrameLayout();
             frameIconBackGroud.Height = this.GetPictrueRealSize(112);
@@ -137,17 +143,17 @@
             btnSwitch.SelectedImagePath = "Item/SwitchSelected.png";
 
             //鍒嗕韩鐨勬埧闂�,鍒欎笉鑳界紪杈戝拰鍒犻櫎
-            if (HdlRoomLogic.Current.CurrentRoom.IsSharedRoom == false)
+            if (this.nowSelectRoom.IsSharedRoom == false)
             {
                 //缂栬緫
                 var btnEditor = this.AddEditorControl();
                 btnEditor.ButtonClickEvent += (sender, e) =>
                 {
                     var detailInfo = new MainPage.DeviceDetailInfoForm();
-                    detailInfo.AddForm(i_device, HdlRoomLogic.Current.CurrentRoom);
-                    detailInfo.FormCloseEvent += (curDevice, curRoom) =>
+                    detailInfo.AddForm(i_device, this.nowSelectRoom);
+                    detailInfo.FormCloseEvent += () =>
                     {
-                        if (HdlRoomLogic.Current.CurrentRoom.IsLove == true)
+                        if (this.nowSelectRoom.IsLove == true)
                         {
                             //褰撳墠鏄枩鐖辨埧闂存椂
                             if (HdlRoomLogic.Current.IsCollectInRoom(this.device) == false)
@@ -159,7 +165,8 @@
                                 return;
                             }
                         }
-                        else if (HdlRoomLogic.Current.CurrentRoom.Id != curRoom.Id)
+                        var curRoom = HdlRoomLogic.Current.GetRoomByDevice(this.device);
+                        if (curRoom == null || this.nowSelectRoom.Id != curRoom.Id)
                         {
                             //鍥炶皟鎺т欢琚Щ闄ょ殑浜嬩欢
                             this.RowNeedRemoveEvent?.Invoke();
@@ -182,7 +189,7 @@
                     {
                         //绉婚櫎鏀惰棌(涓嶇浠�涔堟儏鍐�,鏀惰棌閮借绉婚櫎)
                         HdlRoomLogic.Current.DeleteLoveDevice(i_device);
-                        if (HdlRoomLogic.Current.CurrentRoom.IsLove == false)
+                        if (this.nowSelectRoom.IsLove == false)
                         {
                             //浠庢埧闂翠腑绉婚櫎
                             HdlRoomLogic.Current.DeleteDevice(i_device);
@@ -342,10 +349,9 @@
         /// 娣卞害鍗$墖淇℃伅鐨勮繑鍥炰簨浠�(搴曞眰涓撶敤)
         /// </summary>
         /// <param name="device">璁惧</param>
-        /// <param name="room">鎴块棿</param>
-        public void CardDetailInfoBackEvent(CommonDevice device, Common.Room room)
+        public void CardDetailInfoBackEvent(CommonDevice device)
         {
-            if (HdlRoomLogic.Current.CurrentRoom.IsLove == true)
+            if (this.nowSelectRoom.IsLove == true)
             {
                 //宸茬粡鍙栨秷鐨勬敹钘�
                 if (HdlRoomLogic.Current.IsCollectInRoom(device) == false)
@@ -361,7 +367,7 @@
             {   
                 //濡傛灉杩欎釜璁惧鏀瑰彉浜嗘埧闂寸殑璇�,鍥炶皟鍗$墖琚垹闄ょ殑鍑芥暟
                 var nowRoom = HdlRoomLogic.Current.GetRoomByDevice(device);
-                if (nowRoom == null || nowRoom.Id != HdlRoomLogic.Current.CurrentRoom.Id)
+                if (nowRoom == null || nowRoom.Id != this.nowSelectRoom.Id)
                 {
                     //鍥炶皟鎺т欢琚Щ闄ょ殑浜嬩欢
                     this.RowNeedRemoveEvent?.Invoke();

--
Gitblit v1.8.0