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/2-Classification/RoomPage.cs |  178 +++++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 165 insertions(+), 13 deletions(-)

diff --git a/HDL_ON/UI/UI2/2-Classification/RoomPage.cs b/HDL_ON/UI/UI2/2-Classification/RoomPage.cs
index 9ee72a0..b2138df 100644
--- a/HDL_ON/UI/UI2/2-Classification/RoomPage.cs
+++ b/HDL_ON/UI/UI2/2-Classification/RoomPage.cs
@@ -21,23 +21,52 @@
 
         #region
         static Room room;
-        #endregion 
+        Action skipEditPageAction;
+        Action ReloadRoomName;
+        /// <summary>
+        /// 鍒犻櫎鎴块棿浜嬩欢
+        /// </summary>
+        Action deleteAction;
+        /// <summary>
+        /// 鍥剧墖淇敼浜嬩欢
+        /// </summary>
+        Action modifyImageAction;
 
-        public RoomPage(Room r)
+        #endregion
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="r"></param>
+        /// <param name="rrn">缂栬緫浜嬩欢</param>
+        /// <param name="delAction">鍒犻櫎浜嬩欢鍥炶皟</param>
+        /// <param name="modifyImageAction">鎴块棿鑳屾櫙鍥句慨鏀逛簨浠跺洖璋�</param>
+        public RoomPage(Room r, Action rrn, Action delAction, Action modifyImageAction)
         {
             bodyView = this;
             room = r;
+            skipEditPageAction = () =>
+            {
+                LoadEvent_SkipEditRoomPage();
+            };
+            ReloadRoomName = rrn;
+            deleteAction = delAction;
+            this.modifyImageAction = modifyImageAction;
+        }
+        /// <summary>
+        /// 閲嶈浇鐣岄潰
+        /// </summary>
+        void ReLoadPage()
+        {
+            bodyView.RemoveAll();
+            LoadPage();
         }
 
         public void LoadPage()
         {
-            Action skipAction = () =>
-            {
-                LoadEvent_SkipEditRoomPage();
-            };
             bodyView.BackgroundColor = CSS_Color.BackgroundColor;
 
-            new TopViewDiv(bodyView,room.name).LoadTopView(room ,skipAction);
+            new TopViewDiv(bodyView,room.roomName).LoadTopView_RoomTop(ReloadRoomName, skipEditPageAction);
 
             functionListView = new VerticalScrolViewLayout()
             {
@@ -46,16 +75,16 @@
             };
             bodyView.AddChidren(functionListView);
 
-            foreach (var function in room.functions)
+            foreach (var function in room.GetRoomFunctions(false))
             {
-                if (function.functionCategory == FunctionCategory.Sensor)
+                if (MainPage.RoomNotSupportFunctionList.Contains( function.spk))
                 {
                     continue;
                 }
 
                 functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(12) });
 
-                if (function.functionType == FunctionType.RGB || function.functionType == FunctionType.Dimmer)
+                if (function.spk == SPK.LightRGB || function.spk == SPK.LightDimming)
                 {
                     var functionDiv = new FunctionControlZone(function)
                     {
@@ -66,7 +95,7 @@
                         BorderColor = 0x00FFFFFF,
                         BorderWidth = 1,
                         BackgroundColor = CSS_Color.MainBackgroundColor,
-                        Tag = function.functionCategory.ToString() + "-" + function.functionType + "-" + function.sid
+                        Tag = function.spk + function.sid
                     };
                     functionDiv.LoadFunctionDiv();
                     functionListView.AddChidren(functionDiv);
@@ -82,13 +111,136 @@
                         BorderColor = 0x00FFFFFF,
                         BorderWidth = 1,
                         BackgroundColor = CSS_Color.MainBackgroundColor,
-                        Tag = function.functionCategory.ToString() + "-" + function.functionType + "-" + function.sid
+                        Tag = function.spk + function.sid
                     };
                     functionDiv.LoadFunctionDiv();
                     functionListView.AddChidren(functionDiv);
                 }
             }
-
+            foreach (var scene in room.GetRoomScenes(false))
+            {
+                functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(12) });
+                var sceneRow = new FrameLayout()
+                {
+                    Gravity = Gravity.CenterHorizontal,
+                    Width = Application.GetRealWidth(343),
+                    Height = Application.GetRealHeight(116),
+                    Radius = (uint)Application.GetMinRealAverage(12),
+                    BorderColor = 0x00FFFFFF,
+                    BorderWidth = 1,
+                    BackgroundColor = CSS_Color.MainBackgroundColor,
+                    Tag = "Scene-" +  scene.sid
+                };
+                functionListView.AddChidren(sceneRow);
+                LoadSceneRow(sceneRow, scene);
+            }
         }
+
+
+
+
+        /// <summary>
+        /// 鍔犺浇鍔熻兘绫诲瀷鎺у埗鍗$墖
+        /// </summary>
+        public void LoadSceneRow(FrameLayout bodyDiv, Scene scene)
+        {
+          var  btnIcon = new Button()
+            {
+                X = Application.GetRealWidth(10),
+                Y = Application.GetRealHeight(15),
+                Width = Application.GetRealWidth(32),
+                Height = Application.GetRealWidth(32),
+            };
+            bodyDiv.AddChidren(btnIcon);
+
+            var btnName = new Button()
+            {
+                X = Application.GetRealWidth(8 + 10 + 32),
+                Y = Application.GetRealHeight(10),
+                Width = Application.GetRealWidth(200),
+                Height = Application.GetRealHeight(24),
+                Text = scene.name,
+                TextAlignment = TextAlignment.CenterLeft,
+                TextColor = CSS_Color.FirstLevelTitleColor,
+                TextSize = CSS_FontSize.TextFontSize,
+            };
+            bodyDiv.AddChidren(btnName);
+
+            var btnFromFloor = new Button()
+            {
+                X = Application.GetRealWidth(8 + 10 + 32),
+                Y = Application.GetRealHeight(10 + 24),
+                Width = Application.GetRealWidth(200),
+                Height = Application.GetRealHeight(18),
+                Text = scene.GetRoomListName(),
+                TextAlignment = TextAlignment.CenterLeft,
+                TextColor = CSS_Color.PromptingColor1,
+                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+            };
+            bodyDiv.AddChidren(btnFromFloor);
+
+            var btnCollectionIcon = new Button()
+            {
+                X = Application.GetRealWidth(299),
+                Y = Application.GetRealHeight(10),
+                Width = Application.GetMinRealAverage(40),
+                Height = Application.GetMinRealAverage(40),
+                SelectedImagePath = "Collection/CollectionIcon.png",
+                UnSelectedImagePath = "Collection/CollectionGrayIcon.png",
+                IsSelected = scene.collect
+            };
+            bodyDiv.AddChidren(btnCollectionIcon);
+            //2020-12-16 濡傛灉鏄垚鍛橀殣钘忔敹钘忓姛鑳�
+            //if (!DB_ResidenceData.Instance.CurrentRegion.isOtherShare)
+            //{
+            //    bodyDiv.AddChidren(btnCollectionIcon);
+            //}
+
+            btnIcon.UnSelectedImagePath = "FunctionIcon/Scene/SceneIcon.png";
+            if (scene.sceneType == SceneType.MovieScene)
+            {
+                var movieIcon = new Button()
+                {
+                    X = Application.GetRealWidth(52),
+                    Y = Application.GetRealHeight(14),
+                    Width = Application.GetRealWidth(16),
+                    Height = Application.GetRealWidth(16),
+                    UnSelectedImagePath = "FunctionIcon/Scene/MovieMark.png",
+                };
+                bodyDiv.AddChidren(movieIcon);
+                btnName.X = Application.GetRealWidth(52 + 16);
+            }
+            //鍔犺浇鍦烘櫙鎺у埗浜嬩欢
+            LoadEvent_ControlScene(btnName,btnFromFloor,bodyDiv,scene );
+
+            LoadEvent_FunctionCollection(btnCollectionIcon,scene);
+        }
+
+        /// <summary>
+        /// 鍔犺浇鍔熻兘鏀惰棌鎸夐挳浜嬩欢
+        /// </summary>
+        void LoadEvent_FunctionCollection(Button btnCollectionIcon,Scene scene)
+        {
+            btnCollectionIcon.MouseUpEventHandler += (sender, e) =>
+            {
+                btnCollectionIcon.IsSelected = scene.collect = !btnCollectionIcon.IsSelected;
+                scene.CollectScene();
+            };
+        }
+        /// <summary>
+        /// 鍔犺浇鍦烘櫙鎺у埗浜嬩欢
+        /// </summary>
+        void LoadEvent_ControlScene(Button btnName,Button btnFromFloor,FrameLayout bodyDiv, Scene scene)
+        {
+            EventHandler<MouseEventArgs> upEvent = (sender, e) => {
+                DriverLayer.Control.Ins.ControlScene(scene);
+                string msg = scene.name + Language.StringByID(StringId.AlreadyOpened);
+                new PublicAssmebly().TipMsgAutoClose(msg, false);
+            };
+            btnName.MouseUpEventHandler = upEvent;
+            btnFromFloor.MouseUpEventHandler = upEvent;
+            bodyDiv.MouseUpEventHandler = upEvent;
+        }
+
     }
 }

--
Gitblit v1.8.0