wxr
2023-03-22 a91a9388bef8bbc619dee6db5e369f801a2d2864
HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/CombinedDimmingListPage.cs
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using HDL_ON.DAL.Server;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
@@ -9,6 +10,7 @@
    public class CombinedDimmingListPage : FrameLayout
    {
        FrameLayout bodyView;
        VerticalScrolViewLayout contentView;
        public CombinedDimmingListPage()
        {
@@ -20,10 +22,20 @@
            new TopViewDiv(bodyView, Language.StringByID(StringId.CombinedDimming)).LoadTopView_AddIcon("CombinedDimming",
                (s,c)=>{
                    try
                    {
                        var page = new AddGroupControlPage(new System.Collections.Generic.List<Function>(),new GroupControl(),
                            ()=> {
                            });
                        MainPage.BasePageView.AddChidren(page);
                        page.LoadPage();
                        MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                    }
                    catch { }
                });
            var contentView = new VerticalScrolViewLayout()
            contentView = new VerticalScrolViewLayout()
            {
                Y = Application.GetRealHeight(64),
                Height = Application.GetRealHeight(550),
@@ -37,9 +49,21 @@
                var pack = http.GetGroupControlList();
                if(pack != null)
                {
                    if(pack.Code == StateCode.SUCCESS)
                    if(pack.Code == StateCode.SUCCESS  )
                    {
                        var data = Newtonsoft.Json.JsonConvert.DeserializeObject<GroupControl>(pack.Data.ToString());
                        try
                        {
                            var groupControlList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<GroupControl>>(pack.Data.ToString());
                            LoadGroupControlView(groupControlList);
                        }
                        catch (Exception ex)
                        {
                            MainPage.Log($"读取组控列表失败:{ex.Message}");
                        }
                    }
                    else
                    {
                        IMessageCommon.Current.ShowErrorInfoAlter(pack.Code);
                    }
                }
@@ -47,60 +71,76 @@
            #region 
            contentView.AddChidren(new Button() { Height = Application.GetRealHeight(8) });
            var row = new FrameLayout()
            {
                Height = Application.GetRealHeight(65),
                BackgroundColor = CSS_Color.MainBackgroundColor,
            };
            var btnTitle = new Button()
            {
                X = Application.GetRealWidth(16),
                Y = Application.GetRealHeight(10),
                Width = Application.GetRealWidth(308),
                Height = Application.GetRealHeight(24),
                TextID = StringId.AdministratorPermissionMigration,
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = CSS_FontSize.SubheadingFontSize,
                TextColor = CSS_Color.FirstLevelTitleColor,
            };
            row.AddChidren(btnTitle);
            var btnAdministratorPermissionMigrationExplan = new Button()
            {
                X = Application.GetRealWidth(16),
                Y = btnTitle.Bottom,
                Width = Application.GetRealWidth(308),
                Height = Application.GetRealHeight(21),
                TextID = StringId.AdministratorPermissionMigrationExPlan,
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                TextColor = CSS_Color.PromptingColor1,
            };
            row.AddChidren(btnAdministratorPermissionMigrationExplan);
            var btnAdministratorPermissionMigrationSkinIcon = new Button()
            {
                X = Application.GetRealWidth(343),
                Gravity = Gravity.CenterVertical,
                Width = Application.GetMinRealAverage(16),
                Height = Application.GetMinRealAverage(16),
                UnSelectedImagePath = "Public/RightIcon.png",
            };
            row.AddChidren(btnAdministratorPermissionMigrationSkinIcon);
            row.AddChidren(
                new Button()
                {
                    Gravity = Gravity.CenterHorizontal,
                    Y = Application.GetRealHeight(64),
                    Height = Application.GetRealHeight(1),
                    Width = Application.GetRealWidth(343),
                    BackgroundColor = CSS_Color.DividingLineColor,
                });
            #endregion
        }
        private void LoadGroupControlView(List<GroupControl> list)
        {
            if(list.Count == 0)
            {
            }
            else
            {
                contentView.RemoveAll();
                foreach (var function in list)
                {
                    var functionRow = new FrameLayout()
                    {
                        Height = Application.GetRealHeight(65),
                        BackgroundColor = CSS_Color.MainBackgroundColor,
                    };
                    contentView.AddChidren(functionRow);
                    var btnFunctionName = new Button()
                    {
                        X = Application.GetRealWidth(16),
                        Y = Application.GetRealHeight(10),
                        Width = Application.GetRealWidth(308),
                        Height = Application.GetRealHeight(24),
                        TextAlignment = TextAlignment.CenterLeft,
                        TextSize = CSS_FontSize.SubheadingFontSize,
                        TextColor = CSS_Color.FirstLevelTitleColor,
                        Text = function.name,
                    };
                    functionRow.AddChidren(btnFunctionName);
                    var btnFunctionLocationInfo = new Button()
                    {
                        X = Application.GetRealWidth(16),
                        Y = btnFunctionName.Bottom,
                        Width = Application.GetRealWidth(308),
                        Height = Application.GetRealHeight(21),
                        TextAlignment = TextAlignment.CenterLeft,
                        TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                        TextColor = CSS_Color.PromptingColor1,
                        Text = function.GetRoomListName(),
                    };
                    functionRow.AddChidren(btnFunctionLocationInfo);
                    functionRow.AddChidren(
                        new Button()
                        {
                            Gravity = Gravity.CenterHorizontal,
                            Y = Application.GetRealHeight(64),
                            Height = Application.GetRealHeight(1),
                            Width = Application.GetRealWidth(343),
                            BackgroundColor = CSS_Color.DividingLineColor,
                        });
                }
            }
        }
    }
}