wxr
2020-08-13 6a9ad7ec93218913a2ce3b898bb036f18f8f0da4
HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs
@@ -64,9 +64,14 @@
        #endregion
        List<Room> roomsShowed;
        public ClassificationPage()
        {
            bodyView = this;
            roomsShowed = new List<Room>();
            roomsShowed.AddRange(DB_ResidenceData.residenceData.rooms);
        }
        public void LoadPage()
@@ -112,7 +117,7 @@
            contentPageView = new PageLayout()
            {
                Y = Application.GetRealHeight(64),
                Height = Application.GetRealHeight(667 - 64-49+20),
                Height = Application.GetRealHeight(667 - 64-49+30),
                BackgroundColor = CSS_Color.MainBackgroundColor,
                IsShowPoint = false
            };
@@ -172,7 +177,7 @@
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                TextAlignment = TextAlignment.CenterLeft,
                Text = UserConfig.Instance.CurFoor,
                Text = OnAppConfig.Instance.CurFoor,
            };
            roomFloorChangeView.AddChidren(btnFloor);
            /// <summary>
@@ -190,7 +195,6 @@
            roomFloorChangeView.AddChidren(btnSwitchDipaly);
            #endregion
            /// <summary>
            /// 房间列表区域
            /// </summary>
@@ -198,32 +202,46 @@
            {
                Y = roomFloorChangeView.Bottom,
                Height = Application.GetRealHeight(497 + 10 + 30),
                BackgroundColor = CSS_Color.MainBackgroundColor,
                //BackgroundColor = CSS_Color.MainBackgroundColor,
            };
            roomPageView.AddChidren(roomListView);
            LoadRoomRows();
            roomListView.AddChidren(new Button() { Height = Application.GetRealHeight(20) });//太高视图,将导航了遮挡的部分完整显示
            #endregion
            foreach (var room in DB_ResidenceData.residenceData.rooms)
            LoadDialog_ChangeFloor();
        }
        /// <summary>
        /// 加载房间列表区域
        /// </summary>
        void LoadRoomRows ()
        {
            roomListView.RemoveAll();
            foreach (var room in roomsShowed)
            {
                var roomView = new FrameLayout()
                {
                    Gravity = Gravity.CenterHorizontal,
                    Width = Application.GetRealWidth(343),
                    Height = Application.GetRealHeight(184),
                    Radius = (uint)Application.GetRealHeight(12),
                    BorderColor = 0x00000000,
                    BorderWidth = 1,
                    Radius = (uint)Application.GetRealWidth(12),
                    Tag = room.sid,
                };
                roomListView.AddChidren(roomView);
                var roomViewbg = new Button()
                var roomViewbg = new ImageView()
                {
                    UnSelectedImagePath = room.backgroundImage,
                    Width = Application.GetRealWidth(343),
                    Height = Application.GetRealHeight(184),
                    ImagePath = room.backgroundImage,
                    Radius = (uint)Application.GetRealWidth(12),
                };
                roomView.AddChidren(roomViewbg);
                var roomViewbgColor = new Button()
                {
                    Radius = (uint)Application.GetRealWidth(12),
                    BackgroundColor = 0x19333333,
                };
                roomView.AddChidren(roomViewbgColor);
@@ -256,7 +274,7 @@
                    Gravity = Gravity.CenterVertical,
                    Width = Application.GetMinRealAverage(16),
                    Height = Application.GetMinRealAverage(16),
                    UnSelectedImagePath = "Public/InfoIcon/TempIcon.png",
                    UnSelectedImagePath = "Public/DeviceInfoIcon/TempIcon.png",
                };
                environmentalView.AddChidren(btnTempIcon);
@@ -279,7 +297,7 @@
                    Gravity = Gravity.CenterVertical,
                    Width = Application.GetMinRealAverage(16),
                    Height = Application.GetMinRealAverage(16),
                    UnSelectedImagePath = "Public/InfoIcon/HumidityIcon.png",
                    UnSelectedImagePath = "Public/DeviceInfoIcon/HumidityIcon.png",
                };
                environmentalView.AddChidren(btnHumidityIcon);
@@ -302,7 +320,7 @@
                    Gravity = Gravity.CenterVertical,
                    Width = Application.GetMinRealAverage(16),
                    Height = Application.GetMinRealAverage(16),
                    UnSelectedImagePath = "Public/InfoIcon/Pm25Icon.png",
                    UnSelectedImagePath = "Public/DeviceInfoIcon/Pm25Icon.png",
                };
                environmentalView.AddChidren(btnPm25Icon);
@@ -328,10 +346,10 @@
                    Width = Application.GetMinRealAverage(58),
                    Height = Application.GetMinRealAverage(58),
                    UnSelectedImagePath = "Classification/Room/AllCloseIcon.png",
                    Tag = "AllClose"
                    Tag = "AllClose",
                    Visible = false
                };
                roomView.AddChidren(btnAllClose);
                LoadEvent_CloseAllFunction(btnAllClose, room);
                var btn = new Button()
@@ -348,11 +366,6 @@
                };
            }
            roomListView.AddChidren(new Button() { Height = Application.GetRealHeight(20) });//太高视图,将导航了遮挡的部分完整显示
            #endregion
            LoadDialog_ChangeFloor();
        }
        /// <summary>
@@ -406,7 +419,7 @@
                FrameLayout functionView = new FrameLayout()
                {
                    Height = Application.GetRealWidth(161),
                    Radius = (uint)Application.GetRealHeight(6),
                    Radius = (uint)Application.GetRealWidth(6),
                    BackgroundColor = CSS_Color.MainBackgroundColor,
                    Tag = item + "_View",
                    Y = index % 2 == 1 ? lastY2 : lastY1
@@ -459,7 +472,7 @@
                int functionOnCount = 0;
                switch (item)
                {
                    case FunctionCategory.Light:
                    case ShowFunction.Light:
                        #region Light
                        btnName.TextID = StringId.Lights;
                        functionCount = DB_ResidenceData.residenceData.functionList.lights.Count;
@@ -472,6 +485,7 @@
                            Height = Application.GetRealWidth(32),
                            SelectedImagePath = "Public/PowerOpen.png",
                            UnSelectedImagePath = "Public/PowerClose.png",
                            IsSelected = functionCount == functionOnCount
                        };
                        functionView.AddChidren(btnLightPower);
                        btnLightPower.MouseUpEventHandler = (sender, e) => {
@@ -485,7 +499,7 @@
                        };
                        #endregion
                        break;
                    case FunctionCategory.AC:
                    case ShowFunction.AC:
                        #region AC
                        btnName.TextID = StringId.AC;
                        functionCount = DB_ResidenceData.residenceData.functionList.aCs.Count;
@@ -498,6 +512,7 @@
                            Height = Application.GetRealWidth(32),
                            SelectedImagePath = "Public/PowerOpen.png",
                            UnSelectedImagePath = "Public/PowerClose.png",
                            IsSelected = functionCount == functionOnCount
                        };
                        functionView.AddChidren(btnAcPower);
                        btnAcPower.MouseUpEventHandler = (sender, e) => {
@@ -511,7 +526,7 @@
                        };
                        #endregion
                        break;
                    case FunctionCategory.Curtain:
                    case ShowFunction.Curtain:
                        #region Curtain
                        btnName.TextID = StringId.Curtain;
                        functionCount = DB_ResidenceData.residenceData.functionList.curtains.Count;
@@ -525,6 +540,7 @@
                            Height = Application.GetRealWidth(32),
                            UnSelectedImagePath = "FunctionIcon/Curtain/CurtainCloseIcon.png",
                            SelectedImagePath = "FunctionIcon/Curtain/CurtainCloseOnIcon.png",
                            IsSelected = functionCount == functionOnCount
                        };
                        functionView.AddChidren(btnClose);
@@ -549,68 +565,128 @@
                        };
                        #endregion
                        break;
                    case FunctionCategory.FloorHeating:
                    case ShowFunction.FloorHeating:
                        #region 地热
                        btnName.TextID = StringId.FloorHeating;
                        functionCount = DB_ResidenceData.residenceData.functionList.floorHeatings.Count;
                        functionOnCount = DB_ResidenceData.residenceData.functionList.floorHeatings.FindAll((obj) => obj.on_off == "on").Count;
                        Button btnFhPower = new Button()
                        {
                            X = Application.GetRealWidth(120),
                            Y = specialList.Contains(index) ? Application.GetRealWidth(160) : Application.GetRealWidth(117),
                            Width = Application.GetRealWidth(32),
                            Height = Application.GetRealWidth(32),
                            SelectedImagePath = "Public/PowerOpen.png",
                            UnSelectedImagePath = "Public/PowerClose.png",
                            IsSelected = functionCount == functionOnCount
                        };
                        functionView.AddChidren(btnFhPower);
                        btnFhPower.MouseUpEventHandler = (sender, e) => {
                            LoadEvent_SwitchFunction(btnFhPower, item);
                        };
                        btnFunctionViewBg.MouseUpEventHandler = (sender, e) => {
                            var skipView = new FunctionPage();
                            MainPage.BasePageView.AddChidren(skipView);
                            skipView.LoadPage(StringId.FloorHeating);
                            MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                        };
                        #endregion
                        break;
                    case FunctionCategory.DoorLock:
                    case ShowFunction.DoorLock:
                        btnName.TextID = StringId.DoorLock;
                        break;
                    case FunctionCategory.Electric:
                    case ShowFunction.Electric:
                        #region 电器
                        btnName.TextID = StringId.Electric;
                        functionCount = DB_ResidenceData.residenceData.functionList.electricals.Count;
                        functionOnCount = DB_ResidenceData.residenceData.functionList.electricals.FindAll((obj) => obj.on_off == "on").Count;
                        Button btnElectricPower = new Button()
                        {
                            X = Application.GetRealWidth(120),
                            Y = specialList.Contains(index) ? Application.GetRealWidth(160) : Application.GetRealWidth(117),
                            Width = Application.GetRealWidth(32),
                            Height = Application.GetRealWidth(32),
                            SelectedImagePath = "Public/PowerOpen.png",
                            UnSelectedImagePath = "Public/PowerClose.png",
                            IsSelected = functionCount == functionOnCount
                        };
                        functionView.AddChidren(btnElectricPower);
                        btnElectricPower.MouseUpEventHandler = (sender, e) => {
                            LoadEvent_SwitchFunction(btnElectricPower, item);
                        };
                        btnFunctionViewBg.MouseUpEventHandler = (sender, e) => {
                            var skipView = new FunctionPage();
                            MainPage.BasePageView.AddChidren(skipView);
                            skipView.LoadPage(StringId.Electric);
                            MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                        };
                        #endregion
                        break;
                    case FunctionCategory.EnergyMonitoring:
                    case ShowFunction.EnergyMonitoring:
                        btnName.TextID = StringId.EnergyMonitoring;
                        break;
                    case FunctionCategory.Environmental:
                        btnName.TextID = StringId.Environmental;
                    case ShowFunction.Environmental:
                        #region 环境数据
                        btnName.TextID = StringId.EnvironmentalData;
                        btnFunctionViewBg.MouseUpEventHandler = (sender, e) => {
                            var skipView = new EnvironmentalSciencePage();
                            MainPage.BasePageView.AddChidren(skipView);
                            skipView.LoadPage();
                            MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                        };
                        #endregion
                        break;
                    case FunctionCategory.FreshAir:
                    case ShowFunction.FreshAir:
                        btnName.TextID = StringId.FreshAir;
                        break;
                    case FunctionCategory.Music:
                    case ShowFunction.Music:
                        btnName.TextID = StringId.Music;
                        functionCount = Music.A31MusicModel.A31MusicModelList.Count;
                        functionOnCount = Music.A31MusicModel.A31MusicModelList.FindAll((obj) => obj.on_off == "on").Count;
                        btnFunctionViewBg.MouseUpEventHandler = (sender, e) =>
                        {
                            var musicMain = new Music.MusicMain();
                            MainPage.BasePageView.AddChidren(musicMain);
                            musicMain.Show();
                            MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                        };
                        break;
                    case FunctionCategory.Panel:
                    case ShowFunction.Panel:
                        btnName.TextID = StringId.Panel;
                        break;
                    case FunctionCategory.SecurityMonitoring:
                    case ShowFunction.SecurityMonitoring:
                        btnName.TextID = StringId.SecurityMonitoring;
                        break;
                    case FunctionCategory.Sensor:
                    case ShowFunction.Sensor:
                        btnName.TextID = StringId.Sensor;
                        break;
                    case FunctionCategory.VideoIntercom:
                    case ShowFunction.VideoIntercom:
                        btnName.TextID = StringId.VideoIntercom;
                        break;
                }
                Button btnFunctionCount = new Button()
                if (item != ShowFunction.Environmental)
                {
                    X = Application.GetRealWidth(16),
                    Y = btnName.Bottom,
                    Width = Application.GetRealWidth(120),
                    Height = Application.GetRealHeight(24),
                    TextColor = CSS_Color.FirstLevelTitleColor,
                    TextSize = CSS_FontSize.TextFontSize,
                    TextAlignment = TextAlignment.CenterLeft,
                    Text = functionOnCount + "/" + functionCount,
                    Tag = item + "_onCount"
                };
                functionView.AddChidren(btnFunctionCount);
                    Button btnFunctionCount = new Button()
                    {
                        X = Application.GetRealWidth(16),
                        Y = btnName.Bottom,
                        Width = Application.GetRealWidth(120),
                        Height = Application.GetRealHeight(24),
                        TextColor = CSS_Color.FirstLevelTitleColor,
                        TextSize = CSS_FontSize.TextFontSize,
                        TextAlignment = TextAlignment.CenterLeft,
                        Text = functionOnCount + "/" + functionCount,
                        Tag = item + "_onCount"
                    };
                    functionView.AddChidren(btnFunctionCount);
                }
                index++;
            }
            #endregion
        }
        #region 切换楼层
        /// <summary>
@@ -631,23 +707,77 @@
                    X = Application.GetRealWidth(10),
                    Y = Application.GetRealHeight(100),
                    Width = Application.GetRealWidth(160),
                    Height = Application.GetRealHeight(190),
                    BackgroundImagePath = "PersonalCenter/HomeListbg.png",
                    Height = Application.GetRealHeight(110),
                    BackgroundImagePath = "PersonalCenter/HomeList1bg.png",
                };
                dialogBody.AddChidren(dispalyView);
                var contentView = new VerticalScrolViewLayout()
                {
                    X = Application.GetRealWidth(8),
                    Y = Application.GetRealHeight(10),
                    Y = Application.GetRealHeight(15),
                    Width = Application.GetRealWidth(150),
                    Height = Application.GetRealHeight(44 * 4),
                    Height = Application.GetRealHeight(45 * 2),
                    ScrollEnabled = false
                };
                dispalyView.AddChidren(contentView);
                if (DB_ResidenceData.residenceData.floors.Count < 2)
                {
                }else if (DB_ResidenceData.residenceData.floors.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 (DB_ResidenceData.residenceData.floors.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));
                chooseList.AddRange(DB_ResidenceData.residenceData.floors);
                foreach (var f in DB_ResidenceData.residenceData.floors)
                {
                    chooseList.Add(f.name);
                }
                foreach (var floor in chooseList)
                {
@@ -680,9 +810,23 @@
                    btnHomeName.MouseUpEventHandler += (senderH, en) =>
                    {
                        dialog.Close();
                        btnFloor.Text = floor;
                        UserConfig.Instance.SaveUserConfig();
                        roomsShowed.Clear();
                        if (floor == Language.StringByID(StringId.All))
                        {
                            roomsShowed.AddRange(DB_ResidenceData.residenceData.rooms);
                        }
                        else
                        {
                            foreach (var room in DB_ResidenceData.residenceData.rooms)
                            {
                                if (room.floor == floor)
                                {
                                    roomsShowed.Add(room);
                                }
                            }
                        }
                        LoadRoomRows();
                    };
                }