From f718d23a262a5a8e1241fdeaeb4153399f95e79d Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期二, 21 四月 2020 09:19:05 +0800
Subject: [PATCH] 20200421

---
 HDL_ON/UI/UI2/4-PersonalCenter/ResidentialManage/RoomEditFunctionPage.cs |   48 ++++++++++++++++++++++++++++--------------------
 1 files changed, 28 insertions(+), 20 deletions(-)

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/ResidentialManage/RoomEditFunctionPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/ResidentialManage/RoomEditFunctionPage.cs
index 2753df0..f446425 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/ResidentialManage/RoomEditFunctionPage.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/ResidentialManage/RoomEditFunctionPage.cs
@@ -1,4 +1,5 @@
 锘縰sing System;
+using System.Collections.Generic;
 using HDL_ON.Entity;
 using HDL_ON.UI.CSS;
 using Shared;
@@ -44,14 +45,16 @@
 
         #region 鍖哄煙鍙橀噺
         int showdFunctionCount = 0;
-        string roomId;
+        Room room;
         string showedFunctionRoomId = "0";
+        List<Function> unallocatedList = new List<Function>();
+        List<Function> allocatedList = new List<Function>();
         #endregion
 
-        public RoomEditFunctionPage(string rId)
+        public RoomEditFunctionPage(Room r)
         {
             bodyView = this;
-            roomId = rId;
+            room = r;
         }
 
         /// <summary>
@@ -134,7 +137,20 @@
             };
             bodyView.AddChidren(functionListView);
 
-            LoadFunctionListRow(true);
+            foreach (var function in DB_ResidenceData.residenceData.functionList.functions)
+            {
+                function.roomIdList.Remove(null);
+                if (function.roomIdList.Count > 0 )
+                {
+                    allocatedList.Add(function);
+                }
+                else
+                {
+                    unallocatedList.Add(function);
+                }
+            }
+
+            LoadFunctionListRow(unallocatedList);
 
 
             btnConfrim = new Button()
@@ -161,24 +177,13 @@
         /// 鏄剧ず鍔熻兘Row
         /// </summary>
         /// <param name="showUnallocated">鏄惁鏄樉绀烘湭鍒嗛厤</param>
-        void LoadFunctionListRow(bool showUnallocated)
+        void LoadFunctionListRow(List<Function> functions)
         {
             showdFunctionCount = 0;
             functionListView.RemoveAll();
 
-            foreach (var function in DB_ResidenceData.residenceData.functionList.functions)
+            foreach (var function in functions)
             {
-                if (function.roomIdList.Count > 0 && !function.roomIdList.Contains(roomId) && showUnallocated)
-                {
-                    continue;
-                }
-                if (!showUnallocated && showedFunctionRoomId != null)//濡傛灉闇�瑕佹樉绀哄凡缁忓垎閰嶇殑鍔熻兘锛屽苟涓旀寚瀹氭樉绀哄垎鍒扮殑鎴块棿
-                {
-                    if (!function.roomIdList.Contains(showedFunctionRoomId))//濡傛灉褰撳墠鍔熻兘涓嶆槸闇�瑕佹樉绀虹殑
-                    {
-                        continue;
-                    }
-                }
                 functionListView.AddChidren(new Button()
                 {
                     Gravity = Gravity.CenterHorizontal,
@@ -223,7 +228,7 @@
                         break;
                 }
 
-                if (showUnallocated)
+                if (!btnAllocated.IsSelected)
                 {
                     var btnFunctionName = new Button()
                     {
@@ -273,7 +278,7 @@
                     Height = Application.GetRealWidth(28),
                     SelectedImagePath = "Public/SelectionIcon.png",
                     UnSelectedImagePath = "Public/UnSelectionIcon.png",
-                    IsSelected = function.roomIdList.Contains(roomId)
+                    IsSelected = function.roomIdList.Contains(room.sid)
                 };
                 functionRow.AddChidren(btnChooseIcon);
                 LoadEvent_ChangeRoomFunctionList(functionRow, btnChooseIcon, function);
@@ -284,12 +289,15 @@
             if (showdFunctionCount < 9)
             {
                 functionListView.Height = Application.GetRealHeight(51 * showdFunctionCount);
+            }else
+            {
+                functionListView.Height = Application.GetRealHeight(518 - 40 - 62);
             }
 
         }
 
         /// <summary>
-        /// 鏄剧ず鎴块棿閫変腑寮圭獥
+        /// 鏄剧ず鎴块棿閫夐�夋嫨寮圭獥
         /// </summary>
         void LoadPage_LoadChooseRoomDialog()
         {

--
Gitblit v1.8.0