From 43b0d5870d528f23ecd6aeceb6cfd4325188b46f Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期四, 01 七月 2021 15:50:43 +0800
Subject: [PATCH] Revert "1"

---
 HDL_ON/UI/UI2/2-Classification/FunctionPage.cs |  180 ++++++++++--------------------------------------------------
 1 files changed, 30 insertions(+), 150 deletions(-)

diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs b/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs
index d6c9ad7..47a64cc 100644
--- a/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs
+++ b/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs
@@ -69,7 +69,7 @@
                 TextColor = CSS_Color.FirstLevelTitleColor,
                 TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                 TextAlignment = TextAlignment.CenterLeft,
-                Text = DB_ResidenceData.Instance.CurFoor,
+                Text = DB_ResidenceData.Instance.CurFloor.roomName,
             };
             roomFloorChangeView.AddChidren(btnFloor);
             #endregion
@@ -83,29 +83,37 @@
 
             if (titleId == StringId.Lights)
             {
-                functionList.AddRange(FunctionList.List.lights);
+                functionList.AddRange(FunctionList.List.GetLightList());
             }
             else if (titleId == StringId.AC)
             {
-                functionList.AddRange(FunctionList.List.aCs);
+                functionList.AddRange(FunctionList.List.GetAcList());
             }
             else if (titleId == StringId.Curtain)
             {
-                functionList.AddRange(FunctionList.List.curtains);
+                functionList.AddRange(FunctionList.List.GetCurtainList());
             }
             else if (titleId == StringId.FloorHeating)
             {
-                functionList.AddRange(FunctionList.List.floorHeatings);
+                functionList.AddRange(FunctionList.List.GetFloorHeatingList());
             }
             else if (titleId == StringId.Electric)
             {
-                functionList.AddRange(FunctionList.List.electricals);
+                functionList.AddRange(FunctionList.List.GetElectricals());
             }
             else if (titleId == StringId.EnvironmentalScience)
             {
-                functionList.AddRange(FunctionList.List.sensorsEnvironmentalScience);
+                functionList.AddRange(FunctionList.List.GetEnvirSensorsList());
             }
-            functionList.OrderByDescending(o => o.usageCount).ToList();
+            else if (titleId == StringId.Sensor)
+            {
+                functionList.AddRange(FunctionList.List.GetArmSensorList());
+            }
+            else if (titleId == StringId.FreshAir)
+            {
+                functionList.AddRange(FunctionList.List.GetAirFreshList());
+            }
+            functionList.OrderByDescending(o => o.controlCounter).ToList();
 
             ShowFunctionRow(functionList);
 
@@ -121,7 +129,7 @@
             foreach (var function in showList)
             {
 
-                if (function.functionType == FunctionType.RGB || function.functionType == FunctionType.Dimmer)
+                if (function.spk == SPK.LightRGB || function.spk == SPK.LightDimming)
                 {
                     var functionDiv = new FunctionControlZone(function)
                     {
@@ -132,7 +140,7 @@
                         BorderColor = 0x00FFFFFF,
                         BorderWidth = 1,
                         BackgroundColor = CSS_Color.MainBackgroundColor,
-                        Tag = function.sid
+                        Tag = function.spk + function.sid
                     };
                     functionDiv.LoadFunctionDiv();
                     functionListView.AddChidren(functionDiv);
@@ -148,7 +156,7 @@
                         BorderColor = 0x00FFFFFF,
                         BorderWidth = 1,
                         BackgroundColor = CSS_Color.MainBackgroundColor,
-                        Tag = function.sid
+                        Tag = function.spk + function.sid
                     };
                     functionDiv.LoadFunctionDiv();
                     functionListView.AddChidren(functionDiv);
@@ -163,146 +171,18 @@
         /// </summary>
         void LoadDialog_ChangeFloor()
         {
-            EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
-            {
-                var dialog = new Dialog();
-                var dialogBody = new FrameLayout();
-                dialog.AddChidren(dialogBody);
-                dialogBody.MouseUpEventHandler += (sender1, e1) =>
-                {
-                    dialog.Close();
-                };
-
-                var dispalyView = new FrameLayout()
-                {
-                    X = Application.GetRealWidth(10),
-                    Y = Application.GetRealHeight(100),
-                    Width = Application.GetRealWidth(160),
-                    Height = Application.GetRealHeight(110),
-                    BackgroundImagePath = "PersonalCenter/HomeList1bg.png",
-                };
-                dialogBody.AddChidren(dispalyView);
-
-                var contentView = new VerticalScrolViewLayout()
-                {
-                    X = Application.GetRealWidth(8),
-                    Y = Application.GetRealHeight(15),
-                    Width = Application.GetRealWidth(150),
-                    Height = Application.GetRealHeight(45 * 2),
-                    ScrollEnabled = false
-                };
-                dispalyView.AddChidren(contentView);
-
-                if (SpatialInfo.CurrentSpatial.RoomList.Count < 2)
-                {
-                }
-                else if (SpatialInfo.CurrentSpatial.RoomList.Count < 3)
-                {
-                    dispalyView = new FrameLayout()
-                    {
-                        X = Application.GetRealWidth(10),
-                        Y = Application.GetRealHeight(100),
-                        Width = Application.GetRealWidth(160),
-                        Height = Application.GetRealHeight(155),
-                        BackgroundImagePath = "PersonalCenter/HomeList2bg.png",
-                    };
-                    dialogBody.AddChidren(dispalyView);
-
-                    contentView.Height = Application.GetRealHeight(45 * 3);
-                    dispalyView.AddChidren(contentView);
-                }
-                else if (SpatialInfo.CurrentSpatial.RoomList.Count < 4)
-                {
-                    dispalyView = new FrameLayout()
-                    {
-                        X = Application.GetRealWidth(10),
-                        Y = Application.GetRealHeight(100),
-                        Width = Application.GetRealWidth(160),
-                        Height = Application.GetRealHeight(200),
-                        BackgroundImagePath = "PersonalCenter/HomeList3bg.png",
-                    };
-                    dialogBody.AddChidren(dispalyView);
-
-                    contentView.Height = Application.GetRealHeight(45 * 4);
-                    dispalyView.AddChidren(contentView);
-                }
-                else
-                {
-                    dispalyView = new FrameLayout()
-                    {
-                        X = Application.GetRealWidth(10),
-                        Y = Application.GetRealHeight(100),
-                        Width = Application.GetRealWidth(160),
-                        Height = Application.GetRealHeight(245),
-                        BackgroundImagePath = "PersonalCenter/HomeList4bg.png",
-                    };
-                    dialogBody.AddChidren(dispalyView);
-
-                    contentView.Height = Application.GetRealHeight(45 * 5);
-                    contentView.ScrollEnabled = true;
-                    dispalyView.AddChidren(contentView);
-                }
-
-
-                List<Room> roomList = new List<Room>();
-                roomList.Add(new Room() { roomName = Language.StringByID(StringId.All) });
-                roomList.AddRange(SpatialInfo.CurrentSpatial.RoomList);
-                foreach (var tempRoom in roomList)
-                {
-                    var roomName = tempRoom.roomName;
-                    if (roomName != Language.StringByID(StringId.All))
-                    {
-                        contentView.AddChidren(new Button()
-                        {
-                            Gravity = Gravity.CenterHorizontal,
-                            Width = Application.GetRealWidth(112),
-                            Height = Application.GetRealHeight(1),
-                            BackgroundColor = CSS_Color.BackgroundColor
-                        });
-                    }
-                    var btnHomeName = new Button()
-                    {
-                        Gravity = Gravity.CenterHorizontal,
-                        Width = Application.GetRealWidth(112),
-                        Height = Application.GetRealHeight(44),
-                        TextAlignment = TextAlignment.CenterLeft,
-                        TextColor = CSS_Color.FirstLevelTitleColor,
-                        SelectedTextColor = CSS_Color.MainColor,
-                        Text = roomName,
-                        TextSize = CSS_FontSize.SubheadingFontSize,
-                        IsSelected = btnFloor.Text == roomName,
-                        IsMoreLines = true,
-                    };
-                    contentView.AddChidren(btnHomeName);
-
-                    btnHomeName.MouseUpEventHandler += (senderH, en) =>
-                    {
-                        dialog.Close();
-                        btnFloor.Text = roomName;
-                        if (roomName == Language.StringByID(StringId.All))
-                        {
-                            ShowFunctionRow(functionList);
-                        }
-                        else
-                        {
-                            var showList = new List<Function>();
-                            foreach (var sf in functionList)
-                            {
-                                if(sf.roomIds.Contains(tempRoom.roomId))
-                                {
-                                    showList.Add(sf);
-                                }
-                            }
-                            ShowFunctionRow(showList);
-                        }
-                    };
-                }
-
-                dialog.Show();
+            string nowSelectId = null;
+            btnFloor.MouseUpEventHandler += (sender, e) =>
+            {
+                //鏄剧ず涓嬫媺鍒楄〃
+                var form = new FloorRoomSelectPopupView();
+                form.ShowDeviceFunctionView(btnFloor, this.functionList, (selectId, listFunc) =>
+                {
+                    nowSelectId = selectId;
+                    //閲嶆柊鍔犺浇鐣岄潰
+                    ShowFunctionRow(listFunc);
+                }, nowSelectId);
             };
-
-            btnFloor.MouseUpEventHandler = eventHandler;
-            btnFloorDownIcon.MouseUpEventHandler = eventHandler;
         }
     }
 }
\ No newline at end of file

--
Gitblit v1.8.0