From 611786df5108dca0bdcff03834cc285cba4b8e61 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期二, 13 十月 2020 16:48:43 +0800
Subject: [PATCH] 2020-10-13-1

---
 HDL_ON/UI/UI2/4-PersonalCenter/ResidentialManage/RoomEditFunctionPage.cs |   86 ++++++++++++++++++++++++------------------
 1 files changed, 49 insertions(+), 37 deletions(-)

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/ResidentialManage/RoomEditFunctionPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/ResidentialManage/RoomEditFunctionPage.cs
index 5d7d450..88c6d5b 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;
-        string showedFunctionRoomId="0";
+        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>
@@ -101,7 +104,7 @@
 
             btnChoosedRoom = new Button()
             {
-                X = Application.GetRealWidth(313-100+24),
+                X = Application.GetRealWidth(313 - 100 + 24),
                 Width = Application.GetRealWidth(100),
                 //Height = Application.GetRealHeight(55),
                 TextAlignment = TextAlignment.CenterRight,
@@ -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,
@@ -204,21 +209,26 @@
                 functionRow.AddChidren(btnFunctionIcon);
                 switch (function.functionCategory)
                 {
-                    case FunctionType.AC:
-                        btnFunctionIcon.UnSelectedImagePath = "FunctionIcon/AC/AcThinIcon.png";
+                    case FunctionCategory.Thermostat:
+                        switch (function.functionType)
+                        {
+                            case FunctionType.AC:
+                                btnFunctionIcon.UnSelectedImagePath = "FunctionIcon/AC/AcThinIcon.png";
+                                break;
+                            case FunctionType.FloorHeating:
+                                btnFunctionIcon.UnSelectedImagePath = "FunctionIcon/FloorHeating/FloorHeatingThinIcon.png";
+                                break;
+                        }
                         break;
-                    case FunctionType.Curtain:
+                    case FunctionCategory.Curtain:
                         btnFunctionIcon.UnSelectedImagePath = "FunctionIcon/Curtain/CurtainThinIcon.png";
                         break;
-                    case FunctionType.Light:
+                    case FunctionCategory.Light:
                         btnFunctionIcon.UnSelectedImagePath = "FunctionIcon/Light/LightThinIcon.png";
-                        break;
-                    case FunctionType.FloorHeating:
-                        btnFunctionIcon.UnSelectedImagePath = "FunctionIcon/FloorHeating/FloorHeatingThinIcon.png";
                         break;
                 }
 
-                if (showUnallocated)
+                if (!btnAllocated.IsSelected)
                 {
                     var btnFunctionName = new Button()
                     {
@@ -257,7 +267,6 @@
                         TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel,
                     };
                     functionRow.AddChidren(btnFunctionFloorName);
-
                 }
 
                 Button btnChooseIcon = new Button()
@@ -266,12 +275,12 @@
                     X = Application.GetRealWidth(335),
                     Width = Application.GetRealWidth(28),
                     Height = Application.GetRealWidth(28),
-                    SelectedImagePath = "Public/SelectionIcon.png",
-                    UnSelectedImagePath = "Public/UnSelectionIcon.png",
-                    IsSelected = function.roomIdList.Contains(roomId)
+                    UnSelectedImagePath = "Public/ChooseIcon.png",
+                    SelectedImagePath = "Public/ChooseOnIcon.png",
+                    IsSelected = function.roomIdList.Contains(room.sid)
                 };
                 functionRow.AddChidren(btnChooseIcon);
-                LoadEvent_ChangeRoomFunctionList(functionRow,btnChooseIcon, function);
+                LoadEvent_ChangeRoomFunctionList(functionRow, btnChooseIcon, function);
 
                 showdFunctionCount++;
             }
@@ -279,12 +288,14 @@
             if (showdFunctionCount < 9)
             {
                 functionListView.Height = Application.GetRealHeight(51 * showdFunctionCount);
+            }else
+            {
+                functionListView.Height = Application.GetRealHeight(518 - 40 - 62);
             }
-
         }
 
         /// <summary>
-        /// 鏄剧ず鎴块棿閫変腑寮圭獥
+        /// 鏄剧ず鎴块棿閫夐�夋嫨寮圭獥
         /// </summary>
         void LoadPage_LoadChooseRoomDialog()
         {
@@ -331,7 +342,7 @@
                 Tag = "0"
             };
             roomListView.AddChidren(btnAllRoom);
-            LoadEvent_ChangeShowedFunctionList(btnAllRoom,dialog,Language.StringByID(StringId.All));
+            LoadEvent_ChangeShowedFunctionList(btnAllRoom, dialog, Language.StringByID(StringId.All));
 
             roomListView.AddChidren(new Button()
             {
@@ -357,7 +368,7 @@
                     Tag = tempRoom.sid,
                 };
                 roomListView.AddChidren(btnRoom);
-                LoadEvent_ChangeShowedFunctionList(btnRoom,dialog,tempRoom.name);
+                LoadEvent_ChangeShowedFunctionList(btnRoom, dialog, tempRoom.name);
 
                 roomListView.AddChidren(new Button()
                 {
@@ -367,7 +378,8 @@
                     BackgroundColor = CSS_Color.DividingLineColor,
                 });
             }
-            dialogBodyView.MouseUpEventHandler = (sender, e) => {
+            dialogBodyView.MouseUpEventHandler = (sender, e) =>
+            {
                 dialog.Close();
             };
 

--
Gitblit v1.8.0