黄学彪
2020-12-19 f4c86f68b900bd506ef7214b2ae9bd23a9d2ffa8
HDL_ON/UI/UI2/2-Classification/FunctionPage.cs
@@ -163,146 +163,18 @@
        /// </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.RoomList.Count < 2)
                {
                }
                else if (SpatialInfo.CurrentSpatial.RoomList.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.RoomList.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<Room> roomList = new List<Room>();
                roomList.Add(new Room() { roomName = Language.StringByID(StringId.All) });
                roomList.AddRange(SpatialInfo.CurrentSpatial.RoomList);
                foreach (var tempRoom in roomList)
                {
                    var roomName = tempRoom.roomName;
                    if (roomName != Language.StringByID(StringId.All))
                    {
                        contentView.AddChidren(new Button()
                        {
                            Gravity = Gravity.CenterHorizontal,
                            Width = Application.GetRealWidth(112),
                            Height = Application.GetRealHeight(1),
                            BackgroundColor = CSS_Color.BackgroundColor
                        });
                    }
                    var btnHomeName = new Button()
                    {
                        Gravity = Gravity.CenterHorizontal,
                        Width = Application.GetRealWidth(112),
                        Height = Application.GetRealHeight(44),
                        TextAlignment = TextAlignment.CenterLeft,
                        TextColor = CSS_Color.FirstLevelTitleColor,
                        SelectedTextColor = CSS_Color.MainColor,
                        Text = roomName,
                        TextSize = CSS_FontSize.SubheadingFontSize,
                        IsSelected = btnFloor.Text == roomName,
                        IsMoreLines = true,
                    };
                    contentView.AddChidren(btnHomeName);
                    btnHomeName.MouseUpEventHandler += (senderH, en) =>
                    {
                        dialog.Close();
                        btnFloor.Text = roomName;
                        if (roomName == Language.StringByID(StringId.All))
                        {
                            ShowFunctionRow(functionList);
                        }
                        else
                        {
                            var showList = new List<Function>();
                            foreach (var sf in functionList)
                            {
                                if(sf.roomIds.Contains(tempRoom.roomId))
                                {
                                    showList.Add(sf);
                                }
                            }
                            ShowFunctionRow(showList);
                        }
                    };
                }
                dialog.Show();
            string nowSelectId = null;
            btnFloor.MouseUpEventHandler += (sender, e) =>
            {
                //显示下拉列表
                var form = new FloorRoomSelectPopupView();
                form.ShowDeviceFunctionView(btnFloor, this.functionList, (selectId, listFunc) =>
                {
                    nowSelectId = selectId;
                    //重新加载界面
                    ShowFunctionRow(listFunc);
                }, nowSelectId);
            };
            btnFloor.MouseUpEventHandler = eventHandler;
            btnFloorDownIcon.MouseUpEventHandler = eventHandler;
        }
    }
}