From 8c28c3f43f91510e3a99189243c17717bdee1a0e Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期四, 20 七月 2023 08:58:04 +0800
Subject: [PATCH] 群控功能迭代

---
 HDL_ON/UI/UI2/1-HomePage/HomePage.cs |  294 +++++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 228 insertions(+), 66 deletions(-)

diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs
index 49647e1..a7fd938 100644
--- a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs
+++ b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs
@@ -80,6 +80,10 @@
         /// </summary>
         Button btnChangeScene;
         /// <summary>
+        /// 鍒囨崲鏄剧ず鍦虹粍鎺ф寜閽�
+        /// </summary>
+        Button btnChangeGroupControl;
+        /// <summary>
         /// 鍔熻兘鏄剧ず鍖哄煙
         /// </summary>
         PageLayout contentView;
@@ -92,6 +96,10 @@
         /// </summary>
         VerticalScrolViewLayout sceneFunctionView;
         /// <summary>
+        /// 缁勬帶鎺у埗鍖哄煙
+        /// </summary>
+        VerticalScrolViewLayout gcFunctionView;
+        /// <summary>
         /// 鍔熻兘鍖哄煙闆嗗悎
         /// </summary>
         List<FrameLayout> functionViews;
@@ -100,8 +108,11 @@
 #region 鍖哄煙鍙橀噺
         /// <summary>
         /// 褰撳墠鏄剧ず瀵规帶鍒剁被鍨嬫槸鍚︽槸璁惧鍔熻兘鎺у埗
+        /// 0 鍔熻兘
+        /// 1 鍦烘櫙
+        /// 2 缇ゆ帶
         /// </summary>
-        bool CurShowTypeIsFunction = true;
+        int CurShowTypeContent = 0;
 #endregion
 
 #region 鎶ヨ淇℃伅
@@ -149,10 +160,7 @@
                     bodyView.EndHeaderRefreshing();
                     Common.ApiUtlis.Ins.DownloadData();
                     LoadContentView();
-                    if (!CurShowTypeIsFunction)
-                    {
-                        contentView.PageIndex = 1;
-                    }
+                    contentView.PageIndex = CurShowTypeContent;
                 };
                 topView = new FrameLayout()
                 {
@@ -172,10 +180,7 @@
                     refreshLayout.EndHeaderRefreshing();
                     Common.ApiUtlis.Ins.DownloadData();
                     LoadContentView();
-                    if(!CurShowTypeIsFunction)
-                    {
-                        contentView.PageIndex = 1;
-                    }
+                    contentView.PageIndex = CurShowTypeContent;
                 };
                 topView = new FrameLayout()
                 {
@@ -565,51 +570,124 @@
 
                 bodyView.AddChidren(new Button() { Height = Application.GetRealHeight(20), BackgroundColor = 0x00000000 });
 
-                changeView = new FrameLayout()
+                if (DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl)
                 {
-                    //Y = Application.GetRealHeight(20) + topView.Bottom,
-                    Gravity = Gravity.CenterHorizontal,
-                    Width = Application.GetRealWidth(230),
-                    Height = Application.GetRealHeight(62),
-                    BackgroundImagePath = "Collection/ChangeViewbg.png",
-                };
-                bodyView.AddChidren(changeView);
+                    changeView = new FrameLayout()
+                    {
+                        //Y = Application.GetRealHeight(20) + topView.Bottom,
+                        Gravity = Gravity.CenterHorizontal,
+                        Width = Application.GetRealWidth(334),
+                        Height = Application.GetRealHeight(62),
+                        BackgroundImagePath = "Collection/ChangeViewbg.png",
+                    };
+                    bodyView.AddChidren(changeView);
 
-                btnChangeFunction = new Button()
-                {
-                    X = Application.GetRealWidth(10),
-                    Width = Application.GetRealWidth(114-10),
-                    TextID = StringId.Functions,
-                    SelectedTextColor = CSS_Color.MainColor,
-                    TextColor = CSS_Color.PromptingColor1,
-                    TextSize = CSS_FontSize.HeadlineFontSize,
-                    TextAlignment = TextAlignment.Center,
-                    IsSelected = true,
-                    IsBold = true,
-                };
-                changeView.AddChidren(btnChangeFunction);
+                    btnChangeFunction = new Button()
+                    {
+                        X = Application.GetRealWidth(10),
+                        Width = Application.GetRealWidth(114 - 10),
+                        TextID = StringId.Functions,
+                        SelectedTextColor = CSS_Color.MainColor,
+                        TextColor = CSS_Color.PromptingColor1,
+                        TextSize = CSS_FontSize.HeadlineFontSize,
+                        TextAlignment = TextAlignment.Center,
+                        IsSelected = true,
+                        IsBold = true,
+                    };
+                    changeView.AddChidren(btnChangeFunction);
 
-                Button btnLine = new Button()
-                {
-                    X = btnChangeFunction.Right,
-                    Gravity = Gravity.CenterVertical,
-                    Width = Application.GetRealWidth(1),
-                    Height = Application.GetRealHeight(14),
-                    BackgroundColor = CSS_Color.PromptingColor1,
-                };
-                changeView.AddChidren(btnLine);
+                    Button btnLine = new Button()
+                    {
+                        X = btnChangeFunction.Right,
+                        Gravity = Gravity.CenterVertical,
+                        Width = Application.GetRealWidth(1),
+                        Height = Application.GetRealHeight(14),
+                        BackgroundColor = CSS_Color.PromptingColor1,
+                    };
+                    changeView.AddChidren(btnLine);
 
-                btnChangeScene = new Button()
+                    btnChangeScene = new Button()
+                    {
+                        X = btnLine.Right,
+                        Width = Application.GetRealWidth(114 - 10),
+                        TextID = StringId.Scenes,
+                        SelectedTextColor = CSS_Color.MainColor,
+                        TextColor = CSS_Color.PromptingColor1,
+                        TextSize = CSS_FontSize.TextFontSize,
+                        TextAlignment = TextAlignment.Center,
+                    };
+                    changeView.AddChidren(btnChangeScene);
+
+                    Button btnLine2 = new Button()
+                    {
+                        X = btnChangeScene.Right,
+                        Gravity = Gravity.CenterVertical,
+                        Width = Application.GetRealWidth(1),
+                        Height = Application.GetRealHeight(14),
+                        BackgroundColor = CSS_Color.PromptingColor1,
+                    };
+                    changeView.AddChidren(btnLine2);
+
+                    btnChangeGroupControl = new Button()
+                    {
+                        X = btnLine2.Right,
+                        Width = Application.GetRealWidth(114 - 10),
+                        TextID = StringId.GroupControl,
+                        SelectedTextColor = CSS_Color.MainColor,
+                        TextColor = CSS_Color.PromptingColor1,
+                        TextSize = CSS_FontSize.TextFontSize,
+                        TextAlignment = TextAlignment.Center,
+                    };
+                    changeView.AddChidren(btnChangeGroupControl);
+                }
+                else
                 {
-                    X = btnLine.Right,
-                    Width = Application.GetRealWidth(114-10),
-                    TextID = StringId.Scenes,
-                    SelectedTextColor = CSS_Color.MainColor,
-                    TextColor = CSS_Color.PromptingColor1,
-                    TextSize = CSS_FontSize.TextFontSize,
-                    TextAlignment = TextAlignment.Center,
-                };
-                changeView.AddChidren(btnChangeScene);
+                    changeView = new FrameLayout()
+                    {
+                        //Y = Application.GetRealHeight(20) + topView.Bottom,
+                        Gravity = Gravity.CenterHorizontal,
+                        Width = Application.GetRealWidth(230),
+                        Height = Application.GetRealHeight(62),
+                        BackgroundImagePath = "Collection/ChangeViewbg.png",
+                    };
+                    bodyView.AddChidren(changeView);
+
+                    btnChangeFunction = new Button()
+                    {
+                        X = Application.GetRealWidth(10),
+                        Width = Application.GetRealWidth(114 - 10),
+                        TextID = StringId.Functions,
+                        SelectedTextColor = CSS_Color.MainColor,
+                        TextColor = CSS_Color.PromptingColor1,
+                        TextSize = CSS_FontSize.HeadlineFontSize,
+                        TextAlignment = TextAlignment.Center,
+                        IsSelected = true,
+                        IsBold = true,
+                    };
+                    changeView.AddChidren(btnChangeFunction);
+
+                    Button btnLine = new Button()
+                    {
+                        X = btnChangeFunction.Right,
+                        Gravity = Gravity.CenterVertical,
+                        Width = Application.GetRealWidth(1),
+                        Height = Application.GetRealHeight(14),
+                        BackgroundColor = CSS_Color.PromptingColor1,
+                    };
+                    changeView.AddChidren(btnLine);
+
+                    btnChangeScene = new Button()
+                    {
+                        X = btnLine.Right,
+                        Width = Application.GetRealWidth(114 - 10),
+                        TextID = StringId.Scenes,
+                        SelectedTextColor = CSS_Color.MainColor,
+                        TextColor = CSS_Color.PromptingColor1,
+                        TextSize = CSS_FontSize.TextFontSize,
+                        TextAlignment = TextAlignment.Center,
+                    };
+                    changeView.AddChidren(btnChangeScene);
+                }
                 #endregion
 
                 #region ContextView
@@ -667,12 +745,12 @@
                             sceneFunctionView = new VerticalScrolViewLayout();
                             contentView.AddChidren(sceneFunctionView);
                             LoadSceneFunctionControlZone();
-                            if (CurShowTypeIsFunction)
+                            contentView.PageIndex = CurShowTypeContent;
+                            if (DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl)
                             {
-                                contentView.PageIndex = 0;
-                            }else
-                            {
-                                contentView.PageIndex = 1;
+                                gcFunctionView = new VerticalScrolViewLayout();
+                                contentView.AddChidren(gcFunctionView);
+                                LoadGroupControlFunctionControlZone();
                             }
 
                             LoadEvent_ChangeShowedFunctionType();
@@ -704,15 +782,13 @@
                 sceneFunctionView = new VerticalScrolViewLayout();
                 contentView.AddChidren(sceneFunctionView);
                 LoadSceneFunctionControlZone();
-
-                if (CurShowTypeIsFunction)
+                if (DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl)
                 {
-                    contentView.PageIndex = 0;
+                    gcFunctionView = new VerticalScrolViewLayout();
+                    contentView.AddChidren(gcFunctionView);
+                    LoadGroupControlFunctionControlZone();
                 }
-                else
-                {
-                    contentView.PageIndex = 1;
-                }
+                contentView.PageIndex = CurShowTypeContent;
 
 
                 LoadEvent_ChangeShowedFunctionType();
@@ -730,7 +806,7 @@
         /// </summary>
         void LoadDeviceFunctionControlZone()
         {
-#region ContextView
+            #region ContextView
             deviceFunctionView.RemoveAll();
             functionViews.Clear();
             var rowView = new FrameLayout();
@@ -739,7 +815,7 @@
                 int index = 0;
                 var list = new List<Function>();
                 list.AddRange(FunctionList.List.GetDeviceFunctionList());
-                list.AddRange(FunctionList.List.groupControls);//鍔犲叆缇ゆ帶
+                //list.AddRange(FunctionList.List.groupControls);//鍔犲叆缇ゆ帶
                 foreach (var function in list)
                 {
                     //闊充箰妯″潡鏈変富浠庡叧绯伙紝闇�瑕佺壒娈婂鐞�
@@ -832,9 +908,94 @@
                 MainPage.Log("homepage error : " + ex.Message);
             }
             deviceFunctionView.AddChidren(new Button { Height = Application.GetRealHeight(30) });
-#endregion
-
+            #endregion
         }
+
+
+        /// <summary>
+        /// 鍔犺浇缇ゆ帶鍔熻兘鏄剧ず鍖哄煙
+        /// </summary>
+        void LoadGroupControlFunctionControlZone()
+        {
+            #region ContextView
+            gcFunctionView.RemoveAll();
+            functionViews.Clear();
+            var rowView = new FrameLayout();
+            try
+            {
+                int index = 0;
+                foreach (var function in FunctionList.List.groupControls)
+                {
+                    if (index % 2 == 0)
+                    {
+                        rowView = new FrameLayout()
+                        {
+                            Height = Application.GetRealWidth(140),
+                        };
+                        gcFunctionView.AddChidren(rowView);
+                    }
+                    var functionView_X = Application.GetRealWidth((182 + 7) * (index % 2));
+                    if (index % 2 == 0)
+                    {
+                        functionView_X += Application.GetRealWidth(7);
+                    }
+                    var functionView = new FrameLayout()
+                    {
+                        X = functionView_X,
+                        Width = Application.GetRealWidth(182),
+                        Height = Application.GetRealWidth(140),
+                        Radius = (uint)Application.GetRealWidth(12),
+                        Tag = function.sid
+                    };
+                    rowView.AddChidren(functionView);
+                    functionViews.Add(functionView);
+                        var btnbg = new Button()
+                        {
+                            UnSelectedImagePath = "Collection/Functionbg.png",
+                            SelectedImagePath = "Collection/FunctionOnbg.png",
+                            Tag = function.sid
+                        };
+                        functionView.AddChidren(btnbg);
+                        LoadDeviceFunctionDiv(functionView, function);
+
+                    index++;
+                }
+
+                if (index == 0)
+                {
+                    var view = new FrameLayout();
+                    deviceFunctionView.AddChidren(view);
+
+                    var btnNoCollectionBg = new Button()
+                    {
+                        Y = Application.GetRealHeight(20),
+                        Gravity = Gravity.CenterHorizontal,
+                        Width = Application.GetRealWidth(180),
+                        Height = Application.GetRealWidth(180),
+                        UnSelectedImagePath = "Collection/NoCollectionBg.png",
+                    };
+                    view.AddChidren(btnNoCollectionBg);
+
+                    var btnNoCollectionTip = new Button()
+                    {
+                        Height = Application.GetRealHeight(42),
+                        Y = btnNoCollectionBg.Bottom,
+                        TextAlignment = TextAlignment.Center,
+                        TextColor = CSS_Color.PromptingColor1,
+                        TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+                        //TextID = StringId.TipNoFunctionCollcetion,
+                    };
+                    view.AddChidren(btnNoCollectionTip);
+                }
+            }
+            catch (Exception ex)
+            {
+                MainPage.Log("homepage error : " + ex.Message);
+            }
+            gcFunctionView.AddChidren(new Button { Height = Application.GetRealHeight(30) });
+            #endregion
+        }
+
         /// <summary>
         /// 鍔犺浇鍦烘櫙鍔熻兘鏄剧ず鍖哄煙
         /// </summary>
@@ -1060,7 +1221,8 @@
                     SelectedImagePath = "Collection/CollectionWhiteIcon.png",
                     UnSelectedImagePath = "Collection/CollectionIcon.png",
                 };
-                view.AddChidren(btnCollection);
+                if (function.spk != SPK.GroupControl)//缇ゆ帶榛樿鏄剧ず
+                    view.AddChidren(btnCollection);
                 //2020-12-16 濡傛灉鏄垚鍛橀殣钘忔敹钘忓姛鑳�
                 //if (!DB_ResidenceData.Instance.CurrentRegion.isOtherShare)
                 //{

--
Gitblit v1.8.0