wxr
2023-07-20 8c28c3f43f91510e3a99189243c17717bdee1a0e
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,6 +570,78 @@
                bodyView.AddChidren(new Button() { Height = Application.GetRealHeight(20), BackgroundColor = 0x00000000 });
                if (DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl)
                {
                    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);
                    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);
                    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
                {
                changeView = new FrameLayout()
                {
                    //Y = Application.GetRealHeight(20) + topView.Bottom,
@@ -610,6 +687,7 @@
                    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();
@@ -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)
                {
                    //音乐模块有主从关系,需要特殊处理
@@ -833,8 +909,93 @@
            }
            deviceFunctionView.AddChidren(new Button { Height = Application.GetRealHeight(30) });
#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,6 +1221,7 @@
                    SelectedImagePath = "Collection/CollectionWhiteIcon.png",
                    UnSelectedImagePath = "Collection/CollectionIcon.png",
                };
                if (function.spk != SPK.GroupControl)//群控默认显示
                view.AddChidren(btnCollection);
                //2020-12-16 如果是成员隐藏收藏功能
                //if (!DB_ResidenceData.Instance.CurrentRegion.isOtherShare)