From 6d73bf6e816570291865674bef8bce8972e4de3f Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期三, 01 十二月 2021 16:32:57 +0800
Subject: [PATCH] 2021-12-01-01

---
 HDL_ON/UI/UI2/FuntionControlView/ChooseRoomPage.cs |   88 ++++++++++++++++++++++++++++++--------------
 1 files changed, 60 insertions(+), 28 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/ChooseRoomPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ChooseRoomPage.cs
index b723f7a..f588139 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/ChooseRoomPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/ChooseRoomPage.cs
@@ -5,7 +5,10 @@
 
 namespace HDL_ON.UI
 {
-    public class ChooseRoomPage : FrameLayout
+    /// <summary>
+    /// 鍔熻兘鍒嗛厤鎴块棿鐣岄潰
+    /// </summary>
+    public partial class ChooseRoomPage : FrameLayout
     {
         #region 鎺т欢鍒楄〃
         FrameLayout bodyView;
@@ -13,21 +16,35 @@
         /// 鍐呭鍔犺浇鍖哄煙
         /// </summary>
         VerticalScrolViewLayout contentView;
+
+        Button btnAllRoomText;
+        Button btnChooseAll;
+
         #endregion
 
         #region 灞�閮ㄥ彉閲�
+
+        Function function;
+        /// <summary>
+        /// 鍥炶皟浜嬩欢
+        /// </summary>
+        Action backAction;
         #endregion
 
-        public ChooseRoomPage()
+        public ChooseRoomPage(Function func,Action action)
         {
             bodyView = this;
+            function = func;
+            backAction = action;
         }
 
-
+        /// <summary>
+        /// 鍔犺浇椤甸潰
+        /// </summary>
         public void LoadPage()
         {
             bodyView.BackgroundColor = CSS_Color.BackgroundColor;
-            new PublicAssmebly().LoadTopView(bodyView, Language.StringByID(StringId.LocationManagement));
+            new TopViewDiv(bodyView, Language.StringByID(StringId.LocationManagement)).LoadTopView(backAction);
 
             contentView = new VerticalScrolViewLayout()
             {
@@ -43,18 +60,7 @@
             };
             contentView.AddChidren(allRoomView);
 
-            Button btnAllRoomText = new Button()
-            {
-                X = Application.GetRealWidth(16),
-                Width = Application.GetRealWidth(280),
-                TextID = StringId.All,
-                TextSize= CSS_FontSize.SubheadingFontSize,
-                TextColor = CSS_Color.FirstLevelTitleColor,
-                TextAlignment = TextAlignment.CenterLeft,
-            };
-            allRoomView.AddChidren(btnAllRoomText);
-
-            Button btnChooseAll = new Button()
+            btnChooseAll = new Button()
             {
                 X = Application.GetRealWidth(331),
                 Gravity = Gravity.CenterVertical,
@@ -62,15 +68,28 @@
                 Height = Application.GetMinRealAverage(28),
                 UnSelectedImagePath = "Public/ChooseIcon.png",
                 SelectedImagePath = "Public/ChooseOnIcon.png",
+                IsSelected = true
             };
             allRoomView.AddChidren(btnChooseAll);
 
-            foreach(var room in DB_ResidenceData.residenceData.rooms)
+            btnAllRoomText = new Button()
+            {
+                X = Application.GetRealWidth(16),
+                TextID = StringId.All,
+                TextSize= CSS_FontSize.SubheadingFontSize,
+                TextColor = CSS_Color.FirstLevelTitleColor,
+                TextAlignment = TextAlignment.CenterLeft,
+            };
+            allRoomView.AddChidren(btnAllRoomText);
+
+
+            foreach(var room in SpatialInfo.CurrentSpatial.RoomList)
             {
                 var roomView = new FrameLayout()
                 {
                     Height = Application.GetRealHeight(50),
                     BackgroundColor = CSS_Color.MainBackgroundColor,
+                    Tag = "row"
                 };
                 contentView.AddChidren(roomView);
 
@@ -83,17 +102,6 @@
                 };
                 roomView.AddChidren(btnLine);
 
-                Button btnRoomText = new Button()
-                {
-                    X = Application.GetRealWidth(16),
-                    Width = Application.GetRealWidth(280),
-                    TextSize = CSS_FontSize.SubheadingFontSize,
-                    TextColor = CSS_Color.FirstLevelTitleColor,
-                    TextAlignment = TextAlignment.CenterLeft,
-                    Text = room.floor + "  " + room.name,
-                };
-                roomView.AddChidren(btnRoomText);
-
                 Button btnChoose = new Button()
                 {
                     X = Application.GetRealWidth(331),
@@ -102,10 +110,34 @@
                     Height = Application.GetMinRealAverage(28),
                     UnSelectedImagePath = "Public/ChooseIcon.png",
                     SelectedImagePath = "Public/ChooseOnIcon.png",
+                    IsSelected = function.roomIds.Contains(room.roomId),
+                    Tag = "ChooseIcon"
                 };
                 roomView.AddChidren(btnChoose);
 
+                Button btnRoomText = new Button()
+                {
+                    X = Application.GetRealWidth(16),
+                    //Width = Application.GetRealWidth(280),
+                    TextSize = CSS_FontSize.SubheadingFontSize,
+                    TextColor = CSS_Color.FirstLevelTitleColor,
+                    TextAlignment = TextAlignment.CenterLeft,
+                    Text = room.floorName + room.roomName,
+                };
+                roomView.AddChidren(btnRoomText);
+                btnRoomText.MouseUpEventHandler = (sender, e) => {
+                    btnChoose.IsSelected = !btnChoose.IsSelected;
+                    LoadEvent_RoomSelected(room, btnChoose.IsSelected);
+                };
+
+                if (!function.roomIds.Contains(room.roomId) && btnChooseAll.IsSelected)
+                {
+                    btnChooseAll.IsSelected = false;
+                }
+
             }
+
+            LoadEventLoad();
         }
     }
 }
\ No newline at end of file

--
Gitblit v1.8.0