wxr
2023-03-22 a91a9388bef8bbc619dee6db5e369f801a2d2864
HDL_ON/UI/UI2/4-PersonalCenter/CombinedDimming/AddCombineDimmingPage.cs
@@ -1,127 +1,264 @@
using System;
using Shared;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
//using System;
//using Shared;
//using HDL_ON.Entity;
//using HDL_ON.UI.CSS;
namespace HDL_ON.UI
{
    public class AddCombineDimmingPage : FrameLayout
    {
        FrameLayout bodyView;
        public AddCombineDimmingPage()
        {
            bodyView = this;
        }
        public void LoadPage()
        {
            new TopViewDiv(bodyView, Language.StringByID(StringId.CombinedDimming)).LoadTopView();
            var contentView = new FrameLayout()
            {
                Y = Application.GetRealHeight(64),
                BackgroundColor = CSS_Color.MainBackgroundColor,
                Height = Application.GetRealHeight(550),
            };
            bodyView.AddChidren(contentView);
            #region 住宅名称
            FrameLayout residenceNameRow;
            residenceNameRow = new FrameLayout()
            {
                Y = Application.GetRealHeight(72),
                Height = Application.GetRealHeight(50),
                BackgroundColor = CSS_Color.MainBackgroundColor,
            };
            contentView.AddChidren(residenceNameRow);
            Button btnResidenceNameTitle = new Button()
            {
                X = Application.GetRealWidth(16),
                Width = Application.GetRealWidth(78),
                TextID = StringId.ResidenceName,
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = CSS_FontSize.SubheadingFontSize,
                TextColor = CSS_Color.FirstLevelTitleColor,
            };
            residenceNameRow.AddChidren(btnResidenceNameTitle);
            var btnResidenceName = new Button()
            {
                X = Application.GetRealWidth(2) + btnResidenceNameTitle.Right,
                Width = Application.GetRealWidth(200),
                Text = DB_ResidenceData.Instance.CurrentRegion.homeName,
                TextSize = CSS_FontSize.TextFontSize,
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.TextualColor,
            };
            residenceNameRow.AddChidren(btnResidenceName);
            var btnEditResidenceNameIcon = new Button()
            {
                X = Application.GetRealWidth(333),
                Gravity = Gravity.CenterVertical,
                Width = Application.GetMinRealAverage(28),
                Height = Application.GetMinRealAverage(28),
                UnSelectedImagePath = "Public/Edit.png",
            };
            residenceNameRow.AddChidren(btnEditResidenceNameIcon);
            #endregion
            residenceNameRow.AddChidren(
                new Button()
                {
                    Gravity = Gravity.CenterHorizontal,
                    Y = Application.GetRealHeight(49),
                    Height = Application.GetRealHeight(1),
                    Width = Application.GetRealWidth(343),
                    BackgroundColor = CSS_Color.DividingLineColor,
                });
            #region 住宅地址
            var residenceAddressRow = new FrameLayout()
            {
                Y = residenceNameRow.Bottom,
                Height = Application.GetRealHeight(50),
                BackgroundColor = CSS_Color.MainBackgroundColor,
            };
            contentView.AddChidren(residenceAddressRow);
            var btnResidenceAddressTitle = new Button()
            {
                X = Application.GetRealWidth(16),
                Width = Application.GetRealWidth(78),
                TextID = StringId.ResidenceAddress,
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = CSS_FontSize.SubheadingFontSize,
                TextColor = CSS_Color.FirstLevelTitleColor,
            };
            residenceAddressRow.AddChidren(btnResidenceAddressTitle);
            var btnLocationAddressIcon = new Button()
            {
                X = Application.GetRealWidth(333),
                Gravity = Gravity.CenterVertical,
                Width = Application.GetMinRealAverage(28),
                Height = Application.GetMinRealAverage(28),
                //UnSelectedImagePath = "Public/LocationAddressIcon.png",
                UnSelectedImagePath = "Public/Edit.png",
            };
            residenceAddressRow.AddChidren(btnLocationAddressIcon);
            var btnResidenceAddress = new Button()
            {
                X = Application.GetRealWidth(2) + btnResidenceNameTitle.Right,
                Width = Application.GetRealWidth(200),
                Text = DB_ResidenceData.Instance.CurrentRegion.homeAddress,
                TextSize = CSS_FontSize.TextFontSize,
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.TextualColor,
            };
            residenceAddressRow.AddChidren(btnResidenceAddress);
            #endregion
            contentView.AddChidren(new Button() { Height = Application.GetRealHeight(8) });
//namespace HDL_ON.UI
//{
//    public class AddCombineDimmingPage : FrameLayout
//    {
//        FrameLayout bodyView;
        }
    }
}
//        GroupControl groupControl;
//        public AddCombineDimmingPage()
//        {
//            bodyView = this;
//            groupControl = new GroupControl();
//        }
//        public void LoadPage()
//        {
//            new TopViewDiv(bodyView, Language.StringByID(StringId.CombinedDimming)).LoadTopView();
//            var contentView = new FrameLayout()
//            {
//                Y = Application.GetRealHeight(64),
//                BackgroundColor = CSS_Color.MainBackgroundColor,
//                Height = Application.GetRealHeight(550),
//            };
//            bodyView.AddChidren(contentView);
//            #region 组名称
//            FrameLayout groupNameView;
//            groupNameView = new FrameLayout()
//            {
//                Height = Application.GetRealHeight(50),
//                BackgroundColor = CSS_Color.MainBackgroundColor,
//            };
//            contentView.AddChidren(groupNameView);
//            Button btnGroupNameTitle = new Button()
//            {
//                X = Application.GetRealWidth(16),
//                Width = Application.GetRealWidth(78),
//                TextID = StringId.GroupNmae,
//                TextAlignment = TextAlignment.CenterLeft,
//                TextSize = CSS_FontSize.SubheadingFontSize,
//                TextColor = CSS_Color.FirstLevelTitleColor,
//            };
//            groupNameView.AddChidren(btnGroupNameTitle);
//            var btnGroupName = new EditText()
//            {
//                X = Application.GetRealWidth(155),
//                Width = Application.GetRealWidth(200),
//                PlaceholderText =Language.StringByID( StringId.PlsEntry),
//                TextSize = CSS_FontSize.TextFontSize,
//                TextAlignment = TextAlignment.CenterRight,
//                TextColor = CSS_Color.TextualColor,
//            };
//            groupNameView.AddChidren(btnGroupName);
//            groupNameView.AddChidren(
//                new Button()
//                {
//                    Gravity = Gravity.CenterHorizontal,
//                    Y = Application.GetRealHeight(49),
//                    Height = Application.GetRealHeight(1),
//                    Width = Application.GetRealWidth(343),
//                    BackgroundColor = CSS_Color.DividingLineColor,
//                });
//            #endregion
//            #region 位置管理
//            var locationMagtView = new FrameLayout()
//            {
//                Height = Application.GetRealHeight(55),
//                BackgroundColor = CSS_Color.MainBackgroundColor,
//            };
//            contentView.AddChidren(locationMagtView);
//            var btnLocationMagtTitle = new Button()
//            {
//                X = Application.GetRealWidth(16),
//                Width = Application.GetRealWidth(160),
//                TextAlignment = TextAlignment.CenterLeft,
//                TextColor = CSS_Color.FirstLevelTitleColor,
//                TextSize = CSS_FontSize.SubheadingFontSize,
//                TextID = StringId.LocationManagement,
//            };
//            locationMagtView.AddChidren(btnLocationMagtTitle);
//            var btnLocationValues = new Button()
//            {
//                X = Application.GetRealWidth(86),
//                Width = Application.GetRealWidth(237),
//                TextAlignment = TextAlignment.CenterRight,
//                TextColor = CSS_Color.PromptingColor1,
//                TextSize = CSS_FontSize.TextFontSize,
//                Text = groupControl.GetRoomListName(),
//            };
//            locationMagtView.AddChidren(btnLocationValues);
//            var btnLocationInfoRight = new Button()
//            {
//                X = Application.GetRealWidth(339),
//                Gravity = Gravity.CenterVertical,
//                Width = Application.GetMinRealAverage(16),
//                Height = Application.GetMinRealAverage(16),
//                UnSelectedImagePath = "Public/RightIcon.png",
//            };
//            locationMagtView.AddChidren(btnLocationInfoRight);
//            EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
//            {
//                //修改功能所属房间之后的回调事件
//                Action chooseRoomBackAction = () => {
//                    try
//                    {
//                        btnLocationValues.Text = groupControl.GetRoomListName();
//                    }
//                    catch { }
//                };
//                var view = new GroupChooseRoomPage(groupControl, chooseRoomBackAction);
//                MainPage.BasePageView.AddChidren(view);
//                view.LoadPage();
//                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
//            };
//            if (btnLocationInfoRight != null)
//            {
//                btnLocationInfoRight.MouseUpEventHandler = eventHandler;
//            }
//            if (btnLocationValues != null)
//            {
//                btnLocationValues.MouseUpEventHandler = eventHandler;
//            }
//            locationMagtView.AddChidren(
//                new Button()
//                {
//                    Gravity = Gravity.CenterHorizontal,
//                    BackgroundColor = CSS_Color.DividingLineColor,
//                    Width = Application.GetRealWidth(343),
//                    Height = Application.GetRealHeight(1)
//                });
//            #endregion
//            #region 设备选择
//            contentView.AddChidren(new Button() { Height = Application.GetRealHeight(8) });
//            var chooseFunctionTitleView = new FrameLayout()
//            {
//                Height = Application.GetRealHeight(44),
//                BackgroundColor = CSS_Color.MainBackgroundColor,
//            };
//            contentView.AddChidren(chooseFunctionTitleView);
//            contentView.AddChidren(
//            new Button()
//            {
//                Gravity = Gravity.CenterHorizontal,
//                Y = Application.GetRealHeight(49),
//                Height = Application.GetRealHeight(1),
//                Width = Application.GetRealWidth(343),
//                BackgroundColor = CSS_Color.DividingLineColor,
//            });
//            var btnChooseFunctionTitle = new Button()
//            {
//                X = Application.GetRealWidth(16),
//                TextAlignment = TextAlignment.CenterLeft,
//                TextColor = CSS_Color.MainColor,
//                TextSize = CSS_FontSize.SubheadingFontSize,
//                IsBold = true,
//                TextID = StringId.SelectGroupControlFunction,
//            };
//            chooseFunctionTitleView.AddChidren(btnChooseFunctionTitle);
//            var deviceListView = new VerticalScrolViewLayout()
//            {
//                Height = Application.GetRealHeight(387),
//            };
//            contentView.AddChidren(deviceListView);
//            foreach(var function in FunctionList.List.GetLightList())
//            {
//                var functionRow = new FrameLayout()
//                {
//                    Height = Application.GetRealHeight(65),
//                    BackgroundColor = CSS_Color.MainBackgroundColor,
//                };
//                deviceListView.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);
//            }
//            #endregion
//            #region 底部确认按钮
//            var bottomView = new FrameLayout()
//            {
//                Y = Application.GetRealHeight(591),
//                Height = Application.GetRealHeight(106),
//                BackgroundColor = CSS_Color.MainBackgroundColor,
//                Radius = (uint)Application.GetRealWidth(16),
//            };
//            bodyView.AddChidren(bottomView);
//            var btnConfrim = new Button()
//            {
//                Gravity = Gravity.CenterHorizontal,
//                Y = Application.GetRealHeight(12),
//                Width = Application.GetRealWidth(220),
//                Height = Application.GetRealWidth(44),
//                TextAlignment = TextAlignment.Center,
//                TextColor = CSS_Color.MainBackgroundColor,
//                BackgroundColor = CSS_Color.MainColor,
//                TextSize = CSS_FontSize.SubheadingFontSize,
//                IsBold = true,
//                Radius = (uint)Application.GetRealWidth(22),
//                TextID = StringId.Complete
//            };
//            bottomView.AddChidren(btnConfrim);
//            btnConfrim.MouseUpEventHandler = (sender, e) =>
//            {
//            };
//            #endregion
//        }
//    }
//}