wxr
2020-12-19 4a9318077bd095fbc7c57c593e5ca8185603dac4
HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs
@@ -29,14 +29,6 @@
        /// 筛选文本显示
        /// </summary>
        Button btnScreenText;
        /// <summary>
        /// 筛选条件1
        /// </summary>
        string screen1;
        /// <summary>
        /// 筛选条件2
        /// </summary>
        string screen2;
        VerticalScrolViewLayout functionListView;
@@ -153,7 +145,7 @@
                }
            }
            LoadFunctionListRow();
            LoadFunctionListRow(null);
            LoadEventList();
        }
@@ -162,12 +154,16 @@
        /// 显示功能Row
        /// </summary>
        /// <param name="showUnallocated">是否是显示未分配</param>
        void LoadFunctionListRow()
        void LoadFunctionListRow(List<Function> functions)
        {
            functionListView.RemoveAll();
            List<Function> functions = new List<Function>();
            functions.AddRange(unallocatedList);
            functions.AddRange(allocatedList);
            if (functions == null)
            {
                //初始值
                functions = new List<Function>();
                functions.AddRange(unallocatedList);
                functions.AddRange(allocatedList);
            }
            foreach (var function in functions)
            {
                if (function.functionCategory != FunctionCategory.Light &&
@@ -176,22 +172,6 @@
                    )
                {
                    continue;
                }
                //按楼层筛选
                if (!string.IsNullOrEmpty(screen1))
                {
                    if (!function.roomIds.Contains(screen1))
                    {
                        continue;
                    }
                }
                //按类型筛选
                if (!string.IsNullOrEmpty(screen2))
                {
                    //if (!function.functionType!= screen2)
                    //{
                    //    continue;
                    //}
                }
                functionListView.AddChidren(new Button()
                {
@@ -319,135 +299,24 @@
        /// 住宅列表点击事件
        /// </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.FloorList.Count < 2)
                {
                }
                else if (SpatialInfo.CurrentSpatial.FloorList.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.FloorList.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<string> chooseList = new List<string>();
                chooseList.Add(Language.StringByID(StringId.All));
                foreach (var f in SpatialInfo.CurrentSpatial.FloorList)
                {
                    chooseList.Add(f.roomName);
                }
                foreach (var floor in chooseList)
                {
                    if (floor != Language.StringByID(StringId.All))
                    {
                        contentView.AddChidren(new Button()
                        {
                            Gravity = Gravity.CenterHorizontal,
                            Width = Application.GetRealWidth(112),
                            Height = Application.GetRealHeight(1),
                            BackgroundColor = CSS.CSS_Color.BackgroundColor
                        });
                    }
                    var btnHomeName = new Button()
                    {
                        Gravity = Gravity.CenterHorizontal,
                        Width = Application.GetRealWidth(112),
                        Height = Application.GetRealHeight(44),
                        TextAlignment = TextAlignment.CenterLeft,
                        TextColor = CSS.CSS_Color.FirstLevelTitleColor,
                        SelectedTextColor = CSS.CSS_Color.MainColor,
                        Text = floor,
                        TextSize = CSS.CSS_FontSize.SubheadingFontSize,
                        IsSelected = btnFloor.Text == floor,
                        IsMoreLines = true,
                        Tag = floor
                    };
                    contentView.AddChidren(btnHomeName);
                    btnHomeName.MouseUpEventHandler += (senderH, en) =>
                    {
                        dialog.Close();
                        btnFloor.Text = floor;
                    };
                }
                dialog.Show();
        {
            string nowSelectId = null;
            btnFloor.MouseUpEventHandler += (sender, e) =>
            {
                var listAllFun = new List<Function>();
                listAllFun.AddRange(unallocatedList);
                listAllFun.AddRange(allocatedList);
                //显示下拉界面
                var form = new FloorRoomSelectPopupView();
                form.ShowDeviceFunctionView(btnFloor, listAllFun, (selectId, listFun) =>
                {
                    nowSelectId = selectId;
                    //重新刷新设备列表
                    this.LoadFunctionListRow(listFun);
                }, nowSelectId);
            };
            btnFloor.MouseUpEventHandler = eventHandler;
            btnFloorDownIcon.MouseUpEventHandler = eventHandler;
        }
    }
    //---------------------------------------