From f4c86f68b900bd506ef7214b2ae9bd23a9d2ffa8 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期六, 19 十二月 2020 17:48:11 +0800
Subject: [PATCH] 完成筛选房间的功能

---
 HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs |  231 ++++++++++++---------------------------------------------
 1 files changed, 50 insertions(+), 181 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs
index 3b77f9e..0ad5aaf 100755
--- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs
@@ -21,22 +21,14 @@
         /// </summary>
         Button btnFloor;
 
-        /// <summary>
-        /// 绛涢�夐�夋嫨涓嬫媺鍥炬爣
-        /// </summary>
-        Button btnScreenIcon;
+        ///// <summary>
+        ///// 绛涢�夐�夋嫨涓嬫媺鍥炬爣
+        ///// </summary>
+        //Button btnScreenIcon;
         /// <summary>
         /// 绛涢�夋枃鏈樉绀�
         /// </summary>
         Button btnScreenText;
-        /// <summary>
-        /// 绛涢�夋潯浠�1
-        /// </summary>
-        string screen1;
-        /// <summary>
-        /// 绛涢�夋潯浠�2
-        /// </summary>
-        string screen2;
 
         VerticalScrolViewLayout functionListView;
 
@@ -102,28 +94,28 @@
             showdFunctionTypeRow.AddChidren(btnFloor);
 
 
-            btnScreenIcon = new Button()
-            {
-                Width = Application.GetMinRealAverage(16),
-                Height = Application.GetMinRealAverage(16),
-                X = Application.GetRealWidth(122),
-                Y = Application.GetRealHeight(18),
-                UnSelectedImagePath = "Public/DownIcon.png",
-            };
-            showdFunctionTypeRow.AddChidren(btnScreenIcon);
+            //btnScreenIcon = new Button()
+            //{
+            //    Width = Application.GetMinRealAverage(16),
+            //    Height = Application.GetMinRealAverage(16),
+            //    X = Application.GetRealWidth(122),
+            //    Y = Application.GetRealHeight(18),
+            //    UnSelectedImagePath = "Public/DownIcon.png",
+            //};
+            //showdFunctionTypeRow.AddChidren(btnScreenIcon);
 
-            btnScreenText = new Button()
-            {
-                X = btnScreenIcon.Right,
-                Y = Application.GetRealHeight(18),
-                Width = Application.GetRealWidth(200),
-                Height = Application.GetMinRealAverage(16),
-                TextColor = CSS_Color.FirstLevelTitleColor,
-                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
-                TextAlignment = TextAlignment.CenterLeft,
-                TextID = StringId.Screen
-            };
-            showdFunctionTypeRow.AddChidren(btnScreenText);
+            //btnScreenText = new Button()
+            //{
+            //    X = btnScreenIcon.Right,
+            //    Y = Application.GetRealHeight(18),
+            //    Width = Application.GetRealWidth(200),
+            //    Height = Application.GetMinRealAverage(16),
+            //    TextColor = CSS_Color.FirstLevelTitleColor,
+            //    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+            //    TextAlignment = TextAlignment.CenterLeft,
+            //    TextID = StringId.Screen
+            //};
+            //showdFunctionTypeRow.AddChidren(btnScreenText);
 
 
             #endregion
@@ -153,7 +145,7 @@
                 }
             }
 
-            LoadFunctionListRow();
+            LoadFunctionListRow(null);
 
             LoadEventList();
         }
@@ -162,12 +154,16 @@
         /// 鏄剧ず鍔熻兘Row
         /// </summary>
         /// <param name="showUnallocated">鏄惁鏄樉绀烘湭鍒嗛厤</param>
-        void LoadFunctionListRow()
+        void LoadFunctionListRow(List<Function> functions)
         {
             functionListView.RemoveAll();
-            List<Function> functions = new List<Function>();
-            functions.AddRange(unallocatedList);
-            functions.AddRange(allocatedList);
+            if (functions == null)
+            {
+                //鍒濆鍊�
+                functions = new List<Function>();
+                functions.AddRange(unallocatedList);
+                functions.AddRange(allocatedList);
+            }
             foreach (var function in functions)
             {
                 if (function.functionCategory != FunctionCategory.Light &&
@@ -176,22 +172,6 @@
                     )
                 {
                     continue;
-                }
-                //鎸夋ゼ灞傜瓫閫�
-                if (!string.IsNullOrEmpty(screen1))
-                {
-                    if (!function.roomIds.Contains(screen1))
-                    {
-                        continue;
-                    }
-                }
-                //鎸夌被鍨嬬瓫閫�
-                if (!string.IsNullOrEmpty(screen2))
-                {
-                    //if (!function.functionType!= screen2)
-                    //{
-                    //    continue;
-                    //}
                 }
                 functionListView.AddChidren(new Button()
                 {
@@ -319,135 +299,24 @@
         /// 浣忓畢鍒楄〃鐐瑰嚮浜嬩欢
         /// </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.FloorList.Count < 2)
-                {
-                }
-                else if (SpatialInfo.CurrentSpatial.FloorList.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.FloorList.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<string> chooseList = new List<string>();
-                chooseList.Add(Language.StringByID(StringId.All));
-                foreach (var f in SpatialInfo.CurrentSpatial.FloorList)
-                {
-                    chooseList.Add(f.roomName);
-                }
-
-                foreach (var floor in chooseList)
-                {
-                    if (floor != Language.StringByID(StringId.All))
-                    {
-                        contentView.AddChidren(new Button()
-                        {
-                            Gravity = Gravity.CenterHorizontal,
-                            Width = Application.GetRealWidth(112),
-                            Height = Application.GetRealHeight(1),
-                            BackgroundColor = CSS.CSS_Color.BackgroundColor
-                        });
-                    }
-                    var btnHomeName = new Button()
-                    {
-                        Gravity = Gravity.CenterHorizontal,
-                        Width = Application.GetRealWidth(112),
-                        Height = Application.GetRealHeight(44),
-                        TextAlignment = TextAlignment.CenterLeft,
-                        TextColor = CSS.CSS_Color.FirstLevelTitleColor,
-                        SelectedTextColor = CSS.CSS_Color.MainColor,
-                        Text = floor,
-                        TextSize = CSS.CSS_FontSize.SubheadingFontSize,
-                        IsSelected = btnFloor.Text == floor,
-                        IsMoreLines = true,
-                        Tag = floor
-                    };
-                    contentView.AddChidren(btnHomeName);
-
-                    btnHomeName.MouseUpEventHandler += (senderH, en) =>
-                    {
-                        dialog.Close();
-                        btnFloor.Text = floor;
-                    };
-                }
-
-                dialog.Show();
+        {
+            string nowSelectId = null;
+            btnFloor.MouseUpEventHandler += (sender, e) =>
+            {
+                var listAllFun = new List<Function>();
+                listAllFun.AddRange(unallocatedList);
+                listAllFun.AddRange(allocatedList);
+
+                //鏄剧ず涓嬫媺鐣岄潰
+                var form = new FloorRoomSelectPopupView();
+                form.ShowDeviceFunctionView(btnFloor, listAllFun, (selectId, listFun) =>
+                {
+                    nowSelectId = selectId;
+                    //閲嶆柊鍒锋柊璁惧鍒楄〃
+                    this.LoadFunctionListRow(listFun);
+                }, nowSelectId);
             };
-
-            btnFloor.MouseUpEventHandler = eventHandler;
-            btnFloorDownIcon.MouseUpEventHandler = eventHandler;
         }
-
     }
 
     //---------------------------------------

--
Gitblit v1.8.0