wxr
2021-02-23 34d49c20c2c2543658e844847c5eaa87f4c954e9
HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs
@@ -71,7 +71,7 @@
        {
            bodyView = this;
            roomsShowed = new List<Room>();
            roomsShowed.AddRange(DB_ResidenceData.rooms);
            roomsShowed.AddRange(SpatialInfo.CurrentSpatial.RoomList);
        }
        public void LoadPage()
@@ -117,7 +117,7 @@
            contentPageView = new PageLayout()
            {
                Y = Application.GetRealHeight(64),
                Height = Application.GetRealHeight(667 - 64-49+30),
                Height = Application.GetRealHeight(667 - 64 - 49 + 30),
                BackgroundColor = CSS_Color.MainBackgroundColor,
                IsShowPoint = false
            };
@@ -144,7 +144,7 @@
                Height = Application.GetRealHeight(52),
            };
            roomPageView.AddChidren(roomFloorChangeView);
            #region 房间底部切换显示区域
            #region 房间顶部切换显示区域
            /// <summary>
            /// 房间区域,顶部区域
            /// </summary>
@@ -177,22 +177,22 @@
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                TextAlignment = TextAlignment.CenterLeft,
                Text = OnAppConfig.Instance.CurFoor,
                Text = DB_ResidenceData.Instance.CurFloor.roomName,
            };
            roomFloorChangeView.AddChidren(btnFloor);
            /// <summary>
            /// 显示方式切换按钮
            /// </summary>
            btnSwitchDipaly = new Button()
            {
                X = Application.GetRealWidth(335),
                Y = Application.GetRealHeight(12),
                Width = Application.GetMinRealAverage(28),
                Height = Application.GetMinRealAverage(28),
                UnSelectedImagePath = "Classification/ToggleDisplayThumbnail.png",//缩略图
                SelectedImagePath = "Classification/ToggleDisplayLarge.png",
            };
            roomFloorChangeView.AddChidren(btnSwitchDipaly);
            //btnSwitchDipaly = new Button()
            //{
            //    X = Application.GetRealWidth(335),
            //    Y = Application.GetRealHeight(12),
            //    Width = Application.GetMinRealAverage(28),
            //    Height = Application.GetMinRealAverage(28),
            //    UnSelectedImagePath = "Classification/ToggleDisplayThumbnail.png",//缩略图
            //    SelectedImagePath = "Classification/ToggleDisplayLarge.png",
            //};
            //roomFloorChangeView.AddChidren(btnSwitchDipaly);
            #endregion
            /// <summary>
@@ -215,7 +215,7 @@
        /// <summary>
        /// 加载房间列表区域
        /// </summary>
        void LoadRoomRows ()
        void LoadRoomRows()
        {
            roomListView.RemoveAll();
            foreach (var room in roomsShowed)
@@ -224,20 +224,23 @@
                {
                    Gravity = Gravity.CenterHorizontal,
                    Width = Application.GetRealWidth(343),
                    Height = Application.GetRealHeight(184),
                    Height = Application.GetRealWidth(192),//2020-12-01 房间图片比例改回16:9
                    Radius = (uint)Application.GetRealWidth(12),
                    Tag = room.sid,
                    Tag = room.roomId,
                };
                roomListView.AddChidren(roomView);
                var roomViewbg = new ImageView()
                {
                    Width = Application.GetRealWidth(343),
                    Height = Application.GetRealHeight(184),
                    ImagePath = room.backgroundImage,
                    Height = Application.GetRealWidth(192),//2020-12-01 房间图片比例改回16:9
                    //ImagePath = room.backgroundImage,
                    Radius = (uint)Application.GetRealWidth(12),
                };
                roomView.AddChidren(roomViewbg);
                //2020-12-03 修改图片加载方法
                ImageUtlis.Current.LoadLocalOrNetworkImages(room.backgroundImage, roomViewbg);
                var roomViewbgColor = new Button()
                {
@@ -252,7 +255,7 @@
                    Y = Application.GetRealHeight(12 - 2),
                    Width = Application.GetRealWidth(266),
                    Height = Application.GetRealHeight(22 + 2 + 2),
                    Text = room.floorName + room.name,
                    Text = room.floorName + room.roomName,
                    TextAlignment = TextAlignment.CenterLeft,
                    TextColor = CSS_Color.MainBackgroundColor,
                    TextSize = CSS_FontSize.SubheadingFontSize,
@@ -260,89 +263,88 @@
                roomView.AddChidren(btnFloorAndRoomName);
                #region 环境数据
                var environmentalView = new FrameLayout()
                {
                    Y = Application.GetRealHeight(2) + btnFloorAndRoomName.Bottom,
                    Height = Application.GetRealHeight(32),
                    Tag = "EnvironmentalView",
                };
                roomView.AddChidren(environmentalView);
                //var environmentalView = new FrameLayout()
                //{
                //    Y = Application.GetRealHeight(2) + btnFloorAndRoomName.Bottom,
                //    Height = Application.GetRealHeight(32),
                //    Tag = "EnvironmentalView",
                //};
                //roomView.AddChidren(environmentalView);
                Button btnTempIcon = new Button()
                {
                    X = Application.GetRealWidth(12),
                    Gravity = Gravity.CenterVertical,
                    Width = Application.GetMinRealAverage(16),
                    Height = Application.GetMinRealAverage(16),
                    UnSelectedImagePath = "Public/DeviceInfoIcon/TempIcon.png",
                };
                environmentalView.AddChidren(btnTempIcon);
                //Button btnTempIcon = new Button()
                //{
                //    X = Application.GetRealWidth(12),
                //    Gravity = Gravity.CenterVertical,
                //    Width = Application.GetMinRealAverage(16),
                //    Height = Application.GetMinRealAverage(16),
                //    UnSelectedImagePath = "Public/DeviceInfoIcon/TempIcon.png",
                //};
                //environmentalView.AddChidren(btnTempIcon);
                var btnTempValues = new Button()
                {
                    X = btnTempIcon.Right + Application.GetRealWidth(4),
                    Width = Application.GetRealWidth(30),
                    Gravity = Gravity.CenterVertical,
                    TextColor = CSS.CSS_Color.MainBackgroundColor,
                    TextSize = CSS.CSS_FontSize.PromptFontSize_FirstLevel,
                    Text = "--°",
                    TextAlignment = TextAlignment.CenterLeft,
                    Tag = "TempValues"
                };
                environmentalView.AddChidren(btnTempValues);
                //var btnTempValues = new Button()
                //{
                //    X = btnTempIcon.Right + Application.GetRealWidth(4),
                //    Width = Application.GetRealWidth(30),
                //    Gravity = Gravity.CenterVertical,
                //    TextColor = CSS_Color.MainBackgroundColor,
                //    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                //    Text = "--°",
                //    TextAlignment = TextAlignment.CenterLeft,
                //    Tag = "TempValues"
                //};
                //environmentalView.AddChidren(btnTempValues);
                Button btnHumidityIcon = new Button()
                {
                    X = btnTempValues.Right + Application.GetRealWidth(2),
                    Gravity = Gravity.CenterVertical,
                    Width = Application.GetMinRealAverage(16),
                    Height = Application.GetMinRealAverage(16),
                    UnSelectedImagePath = "Public/DeviceInfoIcon/HumidityIcon.png",
                };
                environmentalView.AddChidren(btnHumidityIcon);
                //Button btnHumidityIcon = new Button()
                //{
                //    X = btnTempValues.Right + Application.GetRealWidth(2),
                //    Gravity = Gravity.CenterVertical,
                //    Width = Application.GetMinRealAverage(16),
                //    Height = Application.GetMinRealAverage(16),
                //    UnSelectedImagePath = "Public/DeviceInfoIcon/HumidityIcon.png",
                //};
                //environmentalView.AddChidren(btnHumidityIcon);
                var btnHumidityValues = new Button()
                {
                    X = btnHumidityIcon.Right + Application.GetRealWidth(4),
                    Width = Application.GetRealWidth(30),
                    Gravity = Gravity.CenterVertical,
                    TextColor = CSS.CSS_Color.MainBackgroundColor,
                    TextSize = CSS.CSS_FontSize.PromptFontSize_FirstLevel,
                    Text = "--%",
                    TextAlignment = TextAlignment.CenterLeft,
                    Tag = "HumidityValues"
                };
                environmentalView.AddChidren(btnHumidityValues);
                //var btnHumidityValues = new Button()
                //{
                //    X = btnHumidityIcon.Right + Application.GetRealWidth(4),
                //    Width = Application.GetRealWidth(30),
                //    Gravity = Gravity.CenterVertical,
                //    TextColor = CSS_Color.MainBackgroundColor,
                //    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                //    Text = "--%",
                //    TextAlignment = TextAlignment.CenterLeft,
                //    Tag = "HumidityValues"
                //};
                //environmentalView.AddChidren(btnHumidityValues);
                Button btnPm25Icon = new Button()
                {
                    X = btnHumidityValues.Right + Application.GetRealWidth(2),
                    Gravity = Gravity.CenterVertical,
                    Width = Application.GetMinRealAverage(16),
                    Height = Application.GetMinRealAverage(16),
                    UnSelectedImagePath = "Public/DeviceInfoIcon/Pm25Icon.png",
                };
                environmentalView.AddChidren(btnPm25Icon);
                //Button btnPm25Icon = new Button()
                //{
                //    X = btnHumidityValues.Right + Application.GetRealWidth(2),
                //    Gravity = Gravity.CenterVertical,
                //    Width = Application.GetMinRealAverage(16),
                //    Height = Application.GetMinRealAverage(16),
                //    UnSelectedImagePath = "Public/DeviceInfoIcon/Pm25Icon.png",
                //};
                //environmentalView.AddChidren(btnPm25Icon);
                var btnPm25Values = new Button()
                {
                    X = btnPm25Icon.Right + Application.GetRealWidth(4),
                    Width = Application.GetRealWidth(30),
                    Gravity = Gravity.CenterVertical,
                    TextColor = CSS.CSS_Color.MainBackgroundColor,
                    TextSize = CSS.CSS_FontSize.PromptFontSize_FirstLevel,
                    Text = "--",
                    TextAlignment = TextAlignment.CenterLeft,
                    Tag = "Pm25Values"
                };
                environmentalView.AddChidren(btnPm25Values);
                roomView.AddChidren(environmentalView);
                //var btnPm25Values = new Button()
                //{
                //    X = btnPm25Icon.Right + Application.GetRealWidth(4),
                //    Width = Application.GetRealWidth(30),
                //    Gravity = Gravity.CenterVertical,
                //    TextColor = CSS_Color.MainBackgroundColor,
                //    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                //    Text = "--",
                //    TextAlignment = TextAlignment.CenterLeft,
                //    Tag = "Pm25Values"
                //};
                //environmentalView.AddChidren(btnPm25Values);
                //roomView.AddChidren(environmentalView);
                #endregion
                var btnAllClose = new Button()
                {
                    X = Application.GetRealWidth(282),
                    Y = Application.GetRealHeight(126),
                    Y = Application.GetRealWidth(126),
                    Width = Application.GetMinRealAverage(58),
                    Height = Application.GetMinRealAverage(58),
                    UnSelectedImagePath = "Classification/Room/AllCloseIcon.png",
@@ -354,13 +356,31 @@
                var btn = new Button()
                {
                    Height = Application.GetRealHeight(20),
                    Height = Application.GetRealWidth(20),
                };
                roomListView.AddChidren(btn);
                roomViewbgColor.MouseUpEventHandler += (sender, e) =>
                {
                    var view = new RoomPage(room);
                    Action ReloadRoomName = () =>
                    {
                        btnFloorAndRoomName.Text = room.floorName + room.roomName;
                    };
                    //房间删除事件
                    Action deleteAction = () =>
                    {
                        roomView.RemoveFromParent();
                    };
                    //房间背景图修改事件回调
                    Action modifyImageAction = () =>
                    {
                        //roomViewbg.ImagePath = room.backgroundImage;
                        ImageUtlis.Current.LoadLocalOrNetworkImages(room.backgroundImage, roomViewbg);
                    };
                    var view = new RoomPage(room, ReloadRoomName, deleteAction, modifyImageAction);
                    MainPage.BasePageView.AddChidren(view);
                    view.LoadPage();
                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
@@ -388,12 +408,8 @@
                Y = Application.GetRealHeight(16),
                Height = Application.GetRealHeight(667 - 64 - 49 + 20),
            };
            if (DB_ResidenceData.residenceData.functionTypeList.Count > 4)
            {
                functionContentView.Height += Application.GetRealHeight((220 * (DB_ResidenceData.residenceData.functionTypeList.Count - 4 - 2) / 2) + 20);
            }
            functionsPageView.AddChidren(functionContentView);
            int index = 0;
            List<int> specialList = new List<int>() { 1, 2, 5, 6, 9, 10, 13, 14, 17, 18, 21, 22 };
@@ -414,9 +430,82 @@
            var lastY1 = Application.GetRealWidth(16);
            var lastY2 = Application.GetRealWidth(16);
            var functionContentViewHeight = Application.GetRealWidth(16);
            foreach (var item in DB_ResidenceData.residenceData.functionTypeList)
            var functionCategoryCount = 0;
            foreach (var item in DB_ResidenceData.Instance.functionTypeList)
            {
                int functionCount = 0;
                int functionOnCount = 0;
                switch (item)
                {
                    case ShowFunction.Light:
                        #region Light
                        functionCount = FunctionList.List.lights.Count;
                        functionOnCount = FunctionList.List.lights.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count;
                        #endregion
                        break;
                    case ShowFunction.AC:
                        #region AC
                        functionCount = FunctionList.List.aCs.Count;
                        functionOnCount = FunctionList.List.aCs.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count;
                        #endregion
                        break;
                    case ShowFunction.Curtain:
                        #region Curtain
                        functionCount = FunctionList.List.curtains.Count;
                        functionOnCount = FunctionList.List.curtains.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count;
                        #endregion
                        break;
                    case ShowFunction.FloorHeating:
                        #region 地热
                        functionCount = FunctionList.List.floorHeatings.Count;
                        functionOnCount = FunctionList.List.floorHeatings.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count;
                        #endregion
                        break;
                    case ShowFunction.DoorLock:
                        break;
                    case ShowFunction.Electric:
                        #region 电器
                        functionCount = FunctionList.List.electricals.Count;
                        functionOnCount = FunctionList.List.electricals.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count;
                        #endregion
                        break;
                    case ShowFunction.EnergyMonitoring:
                        break;
                    case ShowFunction.Environmental:
                        #region 环境数据
                        functionCount = FunctionList.List.sensorsEnvironmentalScience.Count;
                        #endregion
                        break;
                    case ShowFunction.FreshAir:
                        break;
                    case ShowFunction.Music:
                        functionCount = Music.A31MusicModel.A31MusicModelList.Count;
                        functionOnCount = Music.A31MusicModel.A31MusicModelList.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count;
                        break;
                    case ShowFunction.Panel:
                        break;
                    case ShowFunction.SecurityMonitoring:
                        break;
                    case ShowFunction.Sensor:
                        functionCount = FunctionList.List.sensorsArm.Count;
                        //functionOnCount = FunctionList.List.aCs.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count;
                        break;
                    case ShowFunction.VideoIntercom:
                        functionCount = 1;
                        break;
                }
                if(functionCount == 0)
                {
                    continue;
                }
                functionCategoryCount++;
                FrameLayout functionView = new FrameLayout()
                {
                    Height = Application.GetRealWidth(161),
@@ -447,14 +536,8 @@
                {
                    s2View.AddChidren(functionView);
                }
                functionContentViewHeight = functionView.Bottom;
                Button btnFunctionViewBg;
                btnFunctionViewBg = new Button()
                {
                    Height = Application.GetRealWidth(161),
                    UnSelectedImagePath = "FunctionIcon/FunctionBg/" + item + "FunctionBg.png",
                };
                functionView.AddChidren(btnFunctionViewBg);
                Button btnName = new Button()
                {
@@ -468,16 +551,54 @@
                };
                functionView.AddChidren(btnName);
                if (item != ShowFunction.Environmental && item != ShowFunction.Sensor && item != ShowFunction.VideoIntercom
                    && functionCount != 0)
                {
                    Button btnFunctionCount = new Button()
                    {
                        X = Application.GetRealWidth(17) + Application.GetRealWidth(7 * functionCount.ToString().Length),
                        Y = btnName.Bottom,
                        Width = Application.GetRealWidth(120),
                        Height = Application.GetRealHeight(24),
                        TextColor = CSS_Color.PromptingColor1,
                        TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                        TextAlignment = TextAlignment.CenterLeft,
                        Text = "/" + functionCount,
                    };
                    functionView.AddChidren(btnFunctionCount);
                    Button btnOpenCount = new Button()
                    {
                        X = Application.GetRealWidth(16),
                        Y = btnName.Bottom,
                        Width = Application.GetRealWidth(14 * functionCount.ToString().Length),
                        Height = Application.GetRealHeight(24),
                        TextColor = CSS_Color.MainColor,
                        TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                        TextAlignment = TextAlignment.CenterLeft,
                        Text = functionOnCount.ToString(),
                        Tag = item + "_onCount",
                        BorderWidth = 0,
                    };
                    functionView.AddChidren(btnOpenCount);
                }
                int functionCount = 0;
                int functionOnCount = 0;
                Button btnFunctionViewBg;
                btnFunctionViewBg = new Button()
                {
                    Height = Application.GetRealWidth(161),
                    UnSelectedImagePath = "FunctionIcon/FunctionBg/" + item + "FunctionBg.png",
                };
                functionView.AddChidren(btnFunctionViewBg);
                int functionPageTitleId = 0;
                switch (item)
                {
                    case ShowFunction.Light:
                        #region Light
                        btnName.TextID = StringId.Lights;
                        functionCount = DB_ResidenceData.functionList.lights.Count;
                        functionOnCount = DB_ResidenceData.functionList.lights.FindAll((obj) => obj.trait_on_off.value.ToString() == "on").Count;
                        functionCount = FunctionList.List.lights.Count;
                        functionOnCount = FunctionList.List.lights.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count;
                        Button btnLightPower = new Button()
                        {
                            X = Application.GetRealWidth(120),
@@ -486,27 +607,24 @@
                            Height = Application.GetRealWidth(32),
                            SelectedImagePath = "Public/PowerOpen.png",
                            UnSelectedImagePath = "Public/PowerClose.png",
                            IsSelected = functionCount == functionOnCount
                            IsSelected = functionOnCount > 0,
                            Tag = item + "_AllControl",
                        };
                        functionView.AddChidren(btnLightPower);
                        btnLightPower.MouseUpEventHandler = (sender, e) =>
                        {
                            LoadEvent_SwitchFunction(btnLightPower, item);
                            LoadEvent_SwitchFunction(btnLightPower, item, functionView);
                        };
                        btnFunctionViewBg.MouseUpEventHandler = (sender, e) =>
                        {
                            var skipView = new FunctionPage();
                            MainPage.BasePageView.AddChidren(skipView);
                            skipView.LoadPage(StringId.Lights);
                            MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                        };
                        functionPageTitleId = StringId.Lights;
                        #endregion
                        break;
                    case ShowFunction.AC:
                        #region AC
                        btnName.TextID = StringId.AC;
                        functionCount = DB_ResidenceData.functionList.aCs.Count;
                        functionOnCount = DB_ResidenceData.functionList.aCs.FindAll((obj) => obj.trait_on_off.value.ToString() == "on").Count;
                        functionCount = FunctionList.List.aCs.Count;
                        functionOnCount = FunctionList.List.aCs.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count;
                        Button btnAcPower = new Button()
                        {
                            X = Application.GetRealWidth(120),
@@ -515,27 +633,22 @@
                            Height = Application.GetRealWidth(32),
                            SelectedImagePath = "Public/PowerOpen.png",
                            UnSelectedImagePath = "Public/PowerClose.png",
                            IsSelected = functionCount == functionOnCount
                            Tag = item + "_AllControl",
                            IsSelected = functionOnCount > 0,
                        };
                        functionView.AddChidren(btnAcPower);
                        btnAcPower.MouseUpEventHandler = (sender, e) =>
                        {
                            LoadEvent_SwitchFunction(btnAcPower, item);
                            LoadEvent_SwitchFunction(btnAcPower, item, functionView);
                        };
                        btnFunctionViewBg.MouseUpEventHandler = (sender, e) =>
                        {
                            var skipView = new FunctionPage();
                            MainPage.BasePageView.AddChidren(skipView);
                            skipView.LoadPage(StringId.AC);
                            MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                        };
                        functionPageTitleId = StringId.AC;
                        #endregion
                        break;
                    case ShowFunction.Curtain:
                        #region Curtain
                        btnName.TextID = StringId.Curtain;
                        functionCount = DB_ResidenceData.functionList.curtains.Count;
                        functionOnCount = DB_ResidenceData.functionList.curtains.FindAll((obj) => obj.trait_on_off.value.ToString() == "on").Count;
                        functionCount = FunctionList.List.curtains.Count;
                        functionOnCount = FunctionList.List.curtains.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count;
                        Button btnClose;
                        btnClose = new Button()
                        {
@@ -545,7 +658,7 @@
                            Height = Application.GetRealWidth(32),
                            UnSelectedImagePath = "FunctionIcon/Curtain/CurtainCloseIcon.png",
                            SelectedImagePath = "FunctionIcon/Curtain/CurtainCloseOnIcon.png",
                            IsSelected = functionCount == functionOnCount
                            IsSelected = !DB_ResidenceData.Instance.GlobalCurtainStatus,
                        };
                        functionView.AddChidren(btnClose);
@@ -558,24 +671,19 @@
                            Height = Application.GetRealWidth(32),
                            UnSelectedImagePath = "FunctionIcon/Curtain/CurtainOpenIcon.png",
                            SelectedImagePath = "FunctionIcon/Curtain/CurtainOpenOnIcon.png",
                            IsSelected = DB_ResidenceData.Instance.GlobalCurtainStatus,
                        };
                        functionView.AddChidren(btnOpen);
                        LoadEvent_CurtainSwitch(btnClose, btnOpen);
                        LoadEvent_CurtainSwitch(btnClose, btnOpen, functionView);
                        btnFunctionViewBg.MouseUpEventHandler = (sender, e) =>
                        {
                            var skipView = new FunctionPage();
                            MainPage.BasePageView.AddChidren(skipView);
                            skipView.LoadPage(StringId.Curtain);
                            MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                        };
                        functionPageTitleId = StringId.Curtain;
                        #endregion
                        break;
                    case ShowFunction.FloorHeating:
                        #region 地热
                        btnName.TextID = StringId.FloorHeating;
                        functionCount = DB_ResidenceData.functionList.floorHeatings.Count;
                        functionOnCount = DB_ResidenceData.functionList.floorHeatings.FindAll((obj) => obj.trait_on_off.value.ToString() == "on").Count;
                        functionCount = FunctionList.List.floorHeatings.Count;
                        functionOnCount = FunctionList.List.floorHeatings.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count;
                        Button btnFhPower = new Button()
                        {
                            X = Application.GetRealWidth(120),
@@ -584,20 +692,15 @@
                            Height = Application.GetRealWidth(32),
                            SelectedImagePath = "Public/PowerOpen.png",
                            UnSelectedImagePath = "Public/PowerClose.png",
                            IsSelected = functionCount == functionOnCount
                            Tag = item + "_AllControl",
                            IsSelected = functionOnCount > 0
                        };
                        functionView.AddChidren(btnFhPower);
                        btnFhPower.MouseUpEventHandler = (sender, e) =>
                        {
                            LoadEvent_SwitchFunction(btnFhPower, item);
                            LoadEvent_SwitchFunction(btnFhPower, item, functionView);
                        };
                        btnFunctionViewBg.MouseUpEventHandler = (sender, e) =>
                        {
                            var skipView = new FunctionPage();
                            MainPage.BasePageView.AddChidren(skipView);
                            skipView.LoadPage(StringId.FloorHeating);
                            MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                        };
                        functionPageTitleId = StringId.FloorHeating;
                        #endregion
                        break;
                    case ShowFunction.DoorLock:
@@ -606,8 +709,8 @@
                    case ShowFunction.Electric:
                        #region 电器
                        btnName.TextID = StringId.Electric;
                        functionCount = DB_ResidenceData.functionList.electricals.Count;
                        functionOnCount = DB_ResidenceData.functionList.electricals.FindAll((obj) => obj.trait_on_off.value.ToString() == "on").Count;
                        functionCount = FunctionList.List.electricals.Count;
                        functionOnCount = FunctionList.List.electricals.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count;
                        Button btnElectricPower = new Button()
                        {
                            X = Application.GetRealWidth(120),
@@ -616,20 +719,15 @@
                            Height = Application.GetRealWidth(32),
                            SelectedImagePath = "Public/PowerOpen.png",
                            UnSelectedImagePath = "Public/PowerClose.png",
                            IsSelected = functionCount == functionOnCount
                            Tag = item + "_AllControl",
                            IsSelected = functionOnCount > 0,
                        };
                        functionView.AddChidren(btnElectricPower);
                        btnElectricPower.MouseUpEventHandler = (sender, e) =>
                        {
                            LoadEvent_SwitchFunction(btnElectricPower, item);
                            LoadEvent_SwitchFunction(btnElectricPower, item, functionView);
                        };
                        btnFunctionViewBg.MouseUpEventHandler = (sender, e) =>
                        {
                            var skipView = new FunctionPage();
                            MainPage.BasePageView.AddChidren(skipView);
                            skipView.LoadPage(StringId.Electric);
                            MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                        };
                        functionPageTitleId = StringId.Electric;
                        #endregion
                        break;
                    case ShowFunction.EnergyMonitoring:
@@ -653,7 +751,7 @@
                    case ShowFunction.Music:
                        btnName.TextID = StringId.Music;
                        functionCount = Music.A31MusicModel.A31MusicModelList.Count;
                        functionOnCount = Music.A31MusicModel.A31MusicModelList.FindAll((obj) => obj.trait_on_off.value.ToString() == "on").Count;
                        functionOnCount = Music.A31MusicModel.A31MusicModelList.FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count;
                        btnFunctionViewBg.MouseUpEventHandler = (sender, e) =>
                        {
                            var musicMain = new Music.MusicMain();
@@ -670,38 +768,47 @@
                        break;
                    case ShowFunction.Sensor:
                        btnName.TextID = StringId.Sensor;
                        functionPageTitleId = StringId.Sensor;
                        break;
                    case ShowFunction.VideoIntercom:
                        btnName.TextID = StringId.VideoIntercom;
                        btnFunctionViewBg.MouseUpEventHandler = (sender, e) =>
                        {
#if __IOS__
                            EZSDK.IOS.EZSDK.Go2EZvizMonitor();
#else  //安卓摄像头
#endif
                        };
                        break;
                }
                if (item != ShowFunction.Environmental)
                //界面跳转--音乐跳转自己的界面--环境跳转自己的界面
                if (item != ShowFunction.Music && item != ShowFunction.Environmental && item != ShowFunction.VideoIntercom)
                {
                    Button btnFunctionCount = new Button()
                    btnFunctionViewBg.MouseUpEventHandler = (sender, e) =>
                    {
                        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"
                        var skipView = new FunctionPage();
                        MainPage.BasePageView.AddChidren(skipView);
                        skipView.LoadPage(functionPageTitleId);
                        MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                    };
                    functionView.AddChidren(btnFunctionCount);
                }
                index++;
            }
            #endregion
            //if (functionCategoryCount > 4)
            {
                //functionContentView.Height = functionContentViewHeight;// Application.GetRealWidth((240 * (functionCategoryCount / 2)));
                s1View.Height = s2View.Height = functionContentView.Height = functionContentViewHeight+ Application.GetRealWidth(40);
            }
#endregion
        }
        #region 切换楼层
#region 切换楼层
        /// <summary>
        /// 住宅列表点击事件
        /// 楼层显示切换
        /// </summary>
        void LoadDialog_ChangeFloor()
        {
@@ -735,10 +842,10 @@
                };
                dispalyView.AddChidren(contentView);
                if (DB_ResidenceData.residenceData.floors.Count < 2)
                if (SpatialInfo.CurrentSpatial.FloorList.Count < 2)
                {
                }
                else if (DB_ResidenceData.residenceData.floors.Count < 3)
                else if (SpatialInfo.CurrentSpatial.FloorList.Count < 3)
                {
                    dispalyView = new FrameLayout()
                    {
@@ -753,7 +860,7 @@
                    contentView.Height = Application.GetRealHeight(45 * 3);
                    dispalyView.AddChidren(contentView);
                }
                else if (DB_ResidenceData.residenceData.floors.Count < 4)
                else if (SpatialInfo.CurrentSpatial.FloorList.Count < 4)
                {
                    dispalyView = new FrameLayout()
                    {
@@ -786,23 +893,24 @@
                }
                List<string> chooseList = new List<string>();
                chooseList.Add(Language.StringByID(StringId.All));
                foreach (var f in DB_ResidenceData.residenceData.floors)
                List<SpatialInfo> chooseList = new List<SpatialInfo>();
                chooseList.Add(new SpatialInfo() { roomId = "", roomName = Language.StringByID(StringId.All) });
                foreach (var f in SpatialInfo.CurrentSpatial.FloorList)
                {
                    chooseList.Add(f.name);
                    chooseList.Add(f);
                }
                foreach (var floor in chooseList)
                {
                    if (floor != Language.StringByID(StringId.All))
                    if (!string.IsNullOrEmpty( floor.roomId))// != Language.StringByID(StringId.All))
                    {
                        //---分割线
                        contentView.AddChidren(new Button()
                        {
                            Gravity = Gravity.CenterHorizontal,
                            Width = Application.GetRealWidth(112),
                            Height = Application.GetRealHeight(1),
                            BackgroundColor = CSS.CSS_Color.BackgroundColor
                            BackgroundColor = CSS_Color.BackgroundColor
                        });
                    }
                    var btnHomeName = new Button()
@@ -811,30 +919,30 @@
                        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
                        TextColor = CSS_Color.FirstLevelTitleColor,
                        SelectedTextColor = CSS_Color.MainColor,
                        Text = floor.roomName,
                        TextSize = CSS_FontSize.SubheadingFontSize,
                        IsSelected = floor.roomId == DB_ResidenceData.Instance.ClassificationChooseFloor.roomId,
                        //IsMoreLines = true,
                    };
                    contentView.AddChidren(btnHomeName);
                    btnHomeName.MouseUpEventHandler += (senderH, en) =>
                    {
                        dialog.Close();
                        btnFloor.Text = floor;
                        btnFloor.Text = floor.roomName;
                        DB_ResidenceData.Instance.ClassificationChooseFloor = floor;
                        roomsShowed.Clear();
                        if (floor == Language.StringByID(StringId.All))
                        if (string.IsNullOrEmpty(floor.roomId))
                        {
                            roomsShowed.AddRange(DB_ResidenceData.rooms);
                            roomsShowed.AddRange(SpatialInfo.CurrentSpatial.RoomList);
                        }
                        else
                        {
                            foreach (var room in DB_ResidenceData.rooms)
                            foreach (var room in SpatialInfo.CurrentSpatial.RoomList)
                            {
                                if (room.floorName == floor)
                                if (room.parentId == floor.uid)
                                {
                                    roomsShowed.Add(room);
                                }
@@ -855,6 +963,6 @@
        {
        }
        #endregion
#endregion
    }
}
}