From 130a9b9cf4f5cd6ed8c11cb9cd4780f8b7da8bec Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期四, 24 十二月 2020 23:17:59 +0800
Subject: [PATCH] Update ColorTureLampPageBLL.cs

---
 HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditFunctionPageBLL.cs |   54 +++++++++++++++++++++++++++++++-----------------------
 1 files changed, 31 insertions(+), 23 deletions(-)

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditFunctionPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditFunctionPageBLL.cs
index 375c8a3..efaa6ac 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditFunctionPageBLL.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditFunctionPageBLL.cs
@@ -53,14 +53,6 @@
         {
             functionRow.MouseUpEventHandler = (sender, e) => {
                 btn.IsSelected = !btn.IsSelected;
-                if (btn.IsSelected)
-                {
-                    function.roomIds.Add(room.uid);
-                }
-                else
-                {
-                    function.roomIds.Remove(room.uid);
-                }
                 if (changeList.Contains(function))
                 {
                     changeList.Remove(function);
@@ -71,14 +63,7 @@
             };
             btn.MouseUpEventHandler = (sender, e) => {
                 btn.IsSelected = !btn.IsSelected;
-                if (btn.IsSelected)
-                {
-                    function.roomIds.Add(room.uid);
-                }
-                else
-                {
-                    function.roomIds.Remove(room.uid);
-                }
+
                 if (changeList.Contains(function))
                 {
                     changeList.Remove(function);
@@ -118,8 +103,16 @@
                     lastButton.IsSelected = false;
                 }
                 btn.IsSelected = true;
-                showedFunctionRoomId = btn.Tag.ToString() == "0" ? null : btn.Tag.ToString();
-                LoadFunctionListRow(allocatedList.FindAll((obj) => obj.roomIds.Contains(showedFunctionRoomId)));
+                //showedFunctionRoomId = btn.Tag.ToString() == "0" ? null : btn.Tag.ToString();
+                showedFunctionRoomId = btn.Tag.ToString();
+                if (showedFunctionRoomId == "0")
+                {
+                    LoadFunctionListRow(allocatedList);
+                }
+                else
+                {
+                    LoadFunctionListRow(allocatedList.FindAll((obj) => obj.roomIds.Contains(showedFunctionRoomId)));
+                }
                 btnChoosedRoom.Text = chooseRoomName;
                 dialog.Close();
             };
@@ -131,13 +124,28 @@
         void LoadEvent_SaveRoomData()
         {
             btnConfrim.MouseUpEventHandler = (sender, e) => {
-                foreach(var f in changeList)
+                if (string.IsNullOrEmpty(room.roomId))//鏂板鐨勬埧闂达紝浜戠鏈垱寤簉oomid 鏃犳硶淇濆瓨鏁版嵁
                 {
-                    f.SaveFunctionData();
+                    newRoomAddFunction(changeList);
+                    bodyView.RemoveFromParent();
                 }
-                room.SaveRoomData();
-                room.GetRoomFunctions(true);
-                bodyView.RemoveFromParent();
+                else
+                {
+                    foreach (var f in changeList)
+                    {
+                        if(f.roomIds.Contains(room.roomId))
+                        {
+                            f.roomIds.Remove(room.roomId);
+                        }
+                        else
+                        {
+                            f.roomIds.Add(room.roomId);
+                        }
+                        f.UpdataRoomIds();
+                    }
+                    room.GetRoomFunctions(true);
+                    bodyView.RemoveFromParent();
+                }
             };
         }
 

--
Gitblit v1.8.0