From 3dcbd186c42c598c0c08d1cd37034cf2baa09e54 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期一, 30 十二月 2019 15:47:51 +0800
Subject: [PATCH] 合并了代码

---
 ZigbeeApp/Shared/Phone/Device/Room/RoomManagement.cs |   44 +++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 41 insertions(+), 3 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Room/RoomManagement.cs b/ZigbeeApp/Shared/Phone/Device/Room/RoomManagement.cs
index c6f94e4..ea6ea22 100755
--- a/ZigbeeApp/Shared/Phone/Device/Room/RoomManagement.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Room/RoomManagement.cs
@@ -20,10 +20,30 @@
 
         public FrameLayout itemView;
 
+        static RoomManagement roomManagement;
+        public static RoomManagement Instance
+        {
+            get
+            {
+                if (roomManagement == null)
+                {
+                    roomManagement = new RoomManagement { };
+                }
+                return roomManagement;
+            }
+        }
+
+        /// <summary>
+        /// 鏄惁鍙互瑙﹀彂鐐瑰嚮浜嬩欢--鏄惁鍙互璺宠浆涓婚〉鎴块棿
+        /// </summary>
+        public bool CanClick = true;
+
         #endregion
 
 
         public Action action;
+
+
 
         public override void RemoveFromParent()
         {
@@ -35,6 +55,8 @@
         /// </summary>
         public void Show()
         {
+            RemoveAll();
+
             AddTop();
 
             AddBodyView(Config.Instance.Home.CurrentFloorId);
@@ -150,9 +172,20 @@
                     var room = roomList[i];
                     var roomView = new RoomMainView(xx, yy);
                     itemView.AddChidren(roomView);
-                    roomView.Init();
+                    roomView.Init(this,room);
                     roomView.SetRoomName(room.Name);
-                    roomView.SetRoomIcon(room.BackgroundImage);
+                    roomView.SetRoomIcon(room.BackgroundImageType == 0 ? room.BackgroundImage : System.IO.Path.Combine(Config.Instance.FullPath, room.BackgroundImage));
+                    roomView.ClickBtn.MouseUpEventHandler += (sender, e) =>
+                    {
+                        if (CanClick == false)
+                        {
+                            return;
+                        }
+                        CommonPage.Instance.CloseLeftMenu();
+                        Common.Room.CurrentRoom = room;
+                        Config.Instance.Home.CurrentFloorId = room.FloorId;
+                        UserPage.Instance.Fresh();
+                    };
                 }
                 else
                 {
@@ -172,9 +205,10 @@
         /// <summary>
         /// 鎴块棿绠$悊鐣岄潰
         /// </summary>
-        void RoomPage()
+        public RoomManagement()
         {
             BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor;
+            roomManagement = this;
         }
 
         /// <summary>
@@ -184,6 +218,10 @@
         /// <param name="mouseEventArgs"></param>
         private void ShowUnallocatedRoom_MouseUpEvent(object sender,MouseEventArgs mouseEventArgs)
         {
+            if(CanClick==false)
+            {
+                return;
+            }
             var unalloctedRoom = new UnallocatedRoom();
             AddChidren(unalloctedRoom);
             unalloctedRoom.Show();

--
Gitblit v1.8.0