陈嘉乐
2021-03-22 551e82d33c9c23442e0ecd320bcfc752f300d9ef
HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSciencePage.cs
@@ -1,751 +1,751 @@
using System;
using Shared;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
using System.Collections.Generic;
using HDL_ON.DriverLayer;
//using System;
//using Shared;
//using HDL_ON.Entity;
//using HDL_ON.UI.CSS;
//using System.Collections.Generic;
//using HDL_ON.DriverLayer;
namespace HDL_ON.UI
{
    public partial class EnvironmentalSciencePage : FrameLayout
    {
//namespace HDL_ON.UI
//{
//    public partial class EnvironmentalSciencePage : FrameLayout
//    {
        #region 控件集合
        static EnvironmentalSciencePage bodyView;
        /// <summary>
        /// 楼层显示
        /// </summary>
        Button btnRoom;
        /// <summary>
        /// 房间选择下拉图标
        /// </summary>
        Button btnFoorDownIcon;
        /// <summary>
        /// 房间选择触发区域
        /// </summary>
        Button btnRoomClickRow;
        /// <summary>
        /// 传感器列表区域
        /// </summary>
        FrameLayout sensorListView;
//        #region 控件集合
//        static EnvironmentalSciencePage bodyView;
//        /// <summary>
//        /// 楼层显示
//        /// </summary>
//        Button btnRoom;
//        /// <summary>
//        /// 房间选择下拉图标
//        /// </summary>
//        Button btnFoorDownIcon;
//        /// <summary>
//        /// 房间选择触发区域
//        /// </summary>
//        Button btnRoomClickRow;
//        /// <summary>
//        /// 传感器列表区域
//        /// </summary>
//        FrameLayout sensorListView;
        /// <summary>
        /// 天气名称文本
        /// </summary>
        Button btnWatherText;
        /// <summary>
        /// 湿度数据文本
        /// </summary>
        Button btnHumidityText;
        /// <summary>
        /// pm25数据文本
        /// </summary>
        Button btnPm25Values;
        /// <summary>
        /// 风速数据文本
        /// </summary>
        Button btnFanSpeedValues;
//        /// <summary>
//        /// 天气名称文本
//        /// </summary>
//        Button btnWatherText;
//        /// <summary>
//        /// 湿度数据文本
//        /// </summary>
//        Button btnHumidityText;
//        /// <summary>
//        /// pm25数据文本
//        /// </summary>
//        Button btnPm25Values;
//        /// <summary>
//        /// 风速数据文本
//        /// </summary>
//        Button btnFanSpeedValues;
        #endregion
        #region 区域变量
        Room room;
//        #endregion
//        #region 区域变量
//        Room room;
        Sensor sensorTemp = new Sensor();
        #endregion
//        Sensor sensorTemp = new Sensor();
//        #endregion
        public EnvironmentalSciencePage()
        {
            bodyView = this;
        }
//        public EnvironmentalSciencePage()
//        {
//            bodyView = this;
//        }
        /// <summary>
        /// 加载界面
        /// </summary>
        /// <param name="btnCollectionIcon">收藏按钮</param>
        /// <param name="btnFunctionName">功能名称信息按钮</param>
        /// <param name="btnFromFloor">功能楼层信息按钮</param>
        public void LoadPage()
        {
            bodyView.BackgroundColor = CSS_Color.MainBackgroundColor;
//        /// <summary>
//        /// 加载界面
//        /// </summary>
//        /// <param name="btnCollectionIcon">收藏按钮</param>
//        /// <param name="btnFunctionName">功能名称信息按钮</param>
//        /// <param name="btnFromFloor">功能楼层信息按钮</param>
//        public void LoadPage()
//        {
//            bodyView.BackgroundColor = CSS_Color.MainBackgroundColor;
            #region 顶部天气部分
            var topWeatherView = new FrameLayout() {
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealHeight(76),
                Width = Application.GetRealWidth(343),
                Height = Application.GetRealHeight(151),
                BackgroundColor = CSS_Color.MainColor,
                Radius = (uint)Application.GetRealWidth(12),
            };
            bodyView.AddChidren(topWeatherView);
//            #region 顶部天气部分
//            var topWeatherView = new FrameLayout() {
//                Gravity = Gravity.CenterHorizontal,
//                Y = Application.GetRealHeight(76),
//                Width = Application.GetRealWidth(343),
//                Height = Application.GetRealHeight(151),
//                BackgroundColor = CSS_Color.MainColor,
//                Radius = (uint)Application.GetRealWidth(12),
//            };
//            bodyView.AddChidren(topWeatherView);
            var btnTemp = new Button()
            {
                X = Application.GetRealWidth(24),
                Y = Application.GetRealHeight(16),
                Width = Application.GetRealWidth(60),
                Height = Application.GetRealHeight(48),
                TextSize = 42,
                IsBold = true,
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.MainBackgroundColor,
                Text = MainPage.cityInfo.temperature,
            };
            topWeatherView.AddChidren(btnTemp);
//            var btnTemp = new Button()
//            {
//                X = Application.GetRealWidth(24),
//                Y = Application.GetRealHeight(16),
//                Width = Application.GetRealWidth(60),
//                Height = Application.GetRealHeight(48),
//                TextSize = 42,
//                IsBold = true,
//                TextAlignment = TextAlignment.CenterLeft,
//                TextColor = CSS_Color.MainBackgroundColor,
//                Text = MainPage.cityInfo.temperature,
//            };
//            topWeatherView.AddChidren(btnTemp);
            var btnTempUint = new Button()
            {
                X = Application.GetRealWidth(79),
                Y = Application.GetRealHeight(16),
                Width = Application.GetRealWidth(20),
                Height = Application.GetRealHeight(20),
                TextSize = 12,
                TextColor = CSS_Color.MainBackgroundColor,
                Text = "°C",
            };
            topWeatherView.AddChidren(btnTempUint);
//            var btnTempUint = new Button()
//            {
//                X = Application.GetRealWidth(79),
//                Y = Application.GetRealHeight(16),
//                Width = Application.GetRealWidth(20),
//                Height = Application.GetRealHeight(20),
//                TextSize = 12,
//                TextColor = CSS_Color.MainBackgroundColor,
//                Text = "°C",
//            };
//            topWeatherView.AddChidren(btnTempUint);
            var btnWeatherIcon = new Button()
            {
                X = Application.GetRealWidth(115),
                Y = Application.GetRealHeight(16),
                Width = Application.GetRealWidth(20),
                Height = Application.GetRealWidth(20),
                UnSelectedImagePath = "FunctionIcon/EnvironmentalScience/SmogIcon.png",
            };
            topWeatherView.AddChidren(btnWeatherIcon);
            LoadEvent_ChangeWeatherIcon(btnWeatherIcon);
//            var btnWeatherIcon = new Button()
//            {
//                X = Application.GetRealWidth(115),
//                Y = Application.GetRealHeight(16),
//                Width = Application.GetRealWidth(20),
//                Height = Application.GetRealWidth(20),
//                UnSelectedImagePath = "FunctionIcon/EnvironmentalScience/SmogIcon.png",
//            };
//            topWeatherView.AddChidren(btnWeatherIcon);
//            LoadEvent_ChangeWeatherIcon(btnWeatherIcon);
            btnWatherText = new Button()
            {
                X = Application.GetRealWidth(139),
                Y = Application.GetRealHeight(16),
                Width = Application.GetRealWidth(28 * 3),
                Height = Application.GetRealHeight(20),
                TextColor = CSS_Color.MainBackgroundColor,
                TextSize = CSS_FontSize.TextFontSize,
                TextAlignment = TextAlignment.CenterLeft,
                Text = MainPage.cityInfo.weather
            };
            topWeatherView.AddChidren(btnWatherText);
//            btnWatherText = new Button()
//            {
//                X = Application.GetRealWidth(139),
//                Y = Application.GetRealHeight(16),
//                Width = Application.GetRealWidth(28 * 3),
//                Height = Application.GetRealHeight(20),
//                TextColor = CSS_Color.MainBackgroundColor,
//                TextSize = CSS_FontSize.TextFontSize,
//                TextAlignment = TextAlignment.CenterLeft,
//                Text = MainPage.cityInfo.weather
//            };
//            topWeatherView.AddChidren(btnWatherText);
            var btnTempUpperLimit = new Button()
            {
                X = btnWeatherIcon.X,
                Y = Application.GetRealHeight(46),
                Width = Application.GetRealWidth(16),
                Height = Application.GetRealWidth(16),
                UnSelectedImagePath = "FunctionIcon/EnvironmentalScience/UpArrow.png",
            };
            topWeatherView.AddChidren(btnTempUpperLimit);
//            var btnTempUpperLimit = new Button()
//            {
//                X = btnWeatherIcon.X,
//                Y = Application.GetRealHeight(46),
//                Width = Application.GetRealWidth(16),
//                Height = Application.GetRealWidth(16),
//                UnSelectedImagePath = "FunctionIcon/EnvironmentalScience/UpArrow.png",
//            };
//            topWeatherView.AddChidren(btnTempUpperLimit);
            var btnTempUpperLimitText = new Button()
            {
                X = btnTempUpperLimit.Right,
                Y = Application.GetRealHeight(44),
                Width = Application.GetRealWidth(42),
                Height = Application.GetRealHeight(20),
                TextColor = CSS_Color.MainBackgroundColor,
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = CSS_FontSize.TextFontSize,
                Text = "10°C",
            };
            topWeatherView.AddChidren(btnTempUpperLimitText);
//            var btnTempUpperLimitText = new Button()
//            {
//                X = btnTempUpperLimit.Right,
//                Y = Application.GetRealHeight(44),
//                Width = Application.GetRealWidth(42),
//                Height = Application.GetRealHeight(20),
//                TextColor = CSS_Color.MainBackgroundColor,
//                TextAlignment = TextAlignment.CenterLeft,
//                TextSize = CSS_FontSize.TextFontSize,
//                Text = "10°C",
//            };
//            topWeatherView.AddChidren(btnTempUpperLimitText);
            
            var btnTempLowerLimit = new Button()
            {
                X = btnTempUpperLimitText.Right,
                Y = Application.GetRealHeight(46),
                Width = Application.GetRealWidth(16),
                Height = Application.GetRealWidth(16),
                UnSelectedImagePath = "FunctionIcon/EnvironmentalScience/UpArrow.png",
            };
            btnTempLowerLimit.SetRotation(180f);
            topWeatherView.AddChidren(btnTempLowerLimit);
//            var btnTempLowerLimit = new Button()
//            {
//                X = btnTempUpperLimitText.Right,
//                Y = Application.GetRealHeight(46),
//                Width = Application.GetRealWidth(16),
//                Height = Application.GetRealWidth(16),
//                UnSelectedImagePath = "FunctionIcon/EnvironmentalScience/UpArrow.png",
//            };
//            btnTempLowerLimit.SetRotation(180f);
//            topWeatherView.AddChidren(btnTempLowerLimit);
            var btnTempLowerLimitText = new Button()
            {
                X = btnTempLowerLimit.Right,
                Y = Application.GetRealHeight(44),
                Width = Application.GetRealWidth(42),
                Height = Application.GetRealHeight(20),
                TextColor = CSS_Color.MainBackgroundColor,
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = CSS_FontSize.TextFontSize,
                Text = "2°C",
            };
            topWeatherView.AddChidren(btnTempLowerLimitText);
//            var btnTempLowerLimitText = new Button()
//            {
//                X = btnTempLowerLimit.Right,
//                Y = Application.GetRealHeight(44),
//                Width = Application.GetRealWidth(42),
//                Height = Application.GetRealHeight(20),
//                TextColor = CSS_Color.MainBackgroundColor,
//                TextAlignment = TextAlignment.CenterLeft,
//                TextSize = CSS_FontSize.TextFontSize,
//                Text = "2°C",
//            };
//            topWeatherView.AddChidren(btnTempLowerLimitText);
            var btnLocationText = new Button()
            {
                X = Application.GetRealWidth(233),
                Y = Application.GetRealHeight(18),
                Width = Application.GetRealWidth(74),
                Height = Application.GetRealHeight(17),
                TextAlignment = TextAlignment.CenterRight,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                TextColor = CSS_Color.MainBackgroundColor,
                Text = MainPage.cityInfo.location,
            };
            topWeatherView.AddChidren(btnLocationText);
//            var btnLocationText = new Button()
//            {
//                X = Application.GetRealWidth(233),
//                Y = Application.GetRealHeight(18),
//                Width = Application.GetRealWidth(74),
//                Height = Application.GetRealHeight(17),
//                TextAlignment = TextAlignment.CenterRight,
//                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
//                TextColor = CSS_Color.MainBackgroundColor,
//                Text = MainPage.cityInfo.location,
//            };
//            topWeatherView.AddChidren(btnLocationText);
            var btnLocationIcon = new Button()
            {
                X = btnLocationText.Right,
                Y = Application.GetRealHeight(18),
                Width = Application.GetRealWidth(16),
                Height = Application.GetRealHeight(16),
                UnSelectedImagePath = "FunctionIcon/EnvironmentalScience/LocationIcon.png",
            };
            topWeatherView.AddChidren(btnLocationIcon);
//            var btnLocationIcon = new Button()
//            {
//                X = btnLocationText.Right,
//                Y = Application.GetRealHeight(18),
//                Width = Application.GetRealWidth(16),
//                Height = Application.GetRealHeight(16),
//                UnSelectedImagePath = "FunctionIcon/EnvironmentalScience/LocationIcon.png",
//            };
//            topWeatherView.AddChidren(btnLocationIcon);
            Button btnHumidityIcon = new Button()
            {
                X = Application.GetRealWidth(26),
                Y = Application.GetRealHeight(90),
                Width = Application.GetRealWidth(24),
                Height = Application.GetRealWidth(24),
                UnSelectedImagePath = "FunctionIcon/EnvironmentalScience/HumidityIcon.png",
            };
            topWeatherView.AddChidren(btnHumidityIcon);
//            Button btnHumidityIcon = new Button()
//            {
//                X = Application.GetRealWidth(26),
//                Y = Application.GetRealHeight(90),
//                Width = Application.GetRealWidth(24),
//                Height = Application.GetRealWidth(24),
//                UnSelectedImagePath = "FunctionIcon/EnvironmentalScience/HumidityIcon.png",
//            };
//            topWeatherView.AddChidren(btnHumidityIcon);
            btnHumidityText = new Button()
            {
                X = Application.GetRealWidth(15),
                Y = btnHumidityIcon.Bottom,
                Width = Application.GetRealWidth(46),
                Height = Application.GetRealHeight(25),
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.MainBackgroundColor,
                Text = MainPage.cityInfo.humidity + "%",
            };
            topWeatherView.AddChidren(btnHumidityText);
//            btnHumidityText = new Button()
//            {
//                X = Application.GetRealWidth(15),
//                Y = btnHumidityIcon.Bottom,
//                Width = Application.GetRealWidth(46),
//                Height = Application.GetRealHeight(25),
//                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
//                TextAlignment = TextAlignment.Center,
//                TextColor = CSS_Color.MainBackgroundColor,
//                Text = MainPage.cityInfo.humidity + "%",
//            };
//            topWeatherView.AddChidren(btnHumidityText);
            Button btnPm25Icon = new Button()
            {
                X = Application.GetRealWidth(104),
                Y = Application.GetRealHeight(90),
                Width = Application.GetRealWidth(24),
                Height = Application.GetRealWidth(24),
                UnSelectedImagePath = "FunctionIcon/EnvironmentalScience/Pm25Icon.png",
            };
            topWeatherView.AddChidren(btnPm25Icon);
//            Button btnPm25Icon = new Button()
//            {
//                X = Application.GetRealWidth(104),
//                Y = Application.GetRealHeight(90),
//                Width = Application.GetRealWidth(24),
//                Height = Application.GetRealWidth(24),
//                UnSelectedImagePath = "FunctionIcon/EnvironmentalScience/Pm25Icon.png",
//            };
//            topWeatherView.AddChidren(btnPm25Icon);
            btnPm25Values = new Button()
            {
                X = Application.GetRealWidth(90),
                Y = btnHumidityIcon.Bottom,
                Width = Application.GetRealWidth(52),
                Height = Application.GetRealHeight(25),
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.MainBackgroundColor,
                Text = MainPage.cityInfo.pm25,
            };
            topWeatherView.AddChidren(btnPm25Values);
//            btnPm25Values = new Button()
//            {
//                X = Application.GetRealWidth(90),
//                Y = btnHumidityIcon.Bottom,
//                Width = Application.GetRealWidth(52),
//                Height = Application.GetRealHeight(25),
//                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
//                TextAlignment = TextAlignment.Center,
//                TextColor = CSS_Color.MainBackgroundColor,
//                Text = MainPage.cityInfo.pm25,
//            };
//            topWeatherView.AddChidren(btnPm25Values);
            Button btnFanSpeedIcon = new Button()
            {
                X = Application.GetRealWidth(182),
                Y = Application.GetRealHeight(90),
                Width = Application.GetRealWidth(24),
                Height = Application.GetRealWidth(24),
                UnSelectedImagePath = "FunctionIcon/EnvironmentalScience/WeatherFanSpeedIcon.png",
            };
            topWeatherView.AddChidren(btnFanSpeedIcon);
//            Button btnFanSpeedIcon = new Button()
//            {
//                X = Application.GetRealWidth(182),
//                Y = Application.GetRealHeight(90),
//                Width = Application.GetRealWidth(24),
//                Height = Application.GetRealWidth(24),
//                UnSelectedImagePath = "FunctionIcon/EnvironmentalScience/WeatherFanSpeedIcon.png",
//            };
//            topWeatherView.AddChidren(btnFanSpeedIcon);
            btnFanSpeedValues = new Button()
            {
                X = Application.GetRealWidth(162),
                Y = btnFanSpeedIcon.Bottom,
                Width = Application.GetRealWidth(63),
                Height = Application.GetRealHeight(25),
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.MainBackgroundColor,
                Text = MainPage.cityInfo.windLevel,
            };
            topWeatherView.AddChidren(btnFanSpeedValues);
            #endregion
//            btnFanSpeedValues = new Button()
//            {
//                X = Application.GetRealWidth(162),
//                Y = btnFanSpeedIcon.Bottom,
//                Width = Application.GetRealWidth(63),
//                Height = Application.GetRealHeight(25),
//                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
//                TextAlignment = TextAlignment.Center,
//                TextColor = CSS_Color.MainBackgroundColor,
//                Text = MainPage.cityInfo.windLevel,
//            };
//            topWeatherView.AddChidren(btnFanSpeedValues);
//            #endregion
            #region contentView
            FrameLayout contentView = new FrameLayout()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealHeight(239),
                Width = Application.GetRealWidth(343),
                Height = Application.GetRealHeight(418),
                Radius = (uint)Application.GetRealWidth(12),
                BorderColor = 0x00000000,
                BorderWidth = 0,
                BackgroundColor = CSS_Color.BackgroundColor,
            };
            bodyView.AddChidren(contentView);
//            #region contentView
//            FrameLayout contentView = new FrameLayout()
//            {
//                Gravity = Gravity.CenterHorizontal,
//                Y = Application.GetRealHeight(239),
//                Width = Application.GetRealWidth(343),
//                Height = Application.GetRealHeight(418),
//                Radius = (uint)Application.GetRealWidth(12),
//                BorderColor = 0x00000000,
//                BorderWidth = 0,
//                BackgroundColor = CSS_Color.BackgroundColor,
//            };
//            bodyView.AddChidren(contentView);
            #region 房间顶部切换显示区域
            room = new Room() { roomName = Language.StringByID(StringId.All)};
            btnFoorDownIcon = new Button()
            {
                Width = Application.GetMinRealAverage(16),
                Height = Application.GetMinRealAverage(16),
                X = Application.GetRealWidth(16),
                Y = Application.GetRealHeight(18),
                UnSelectedImagePath = "Public/DownIcon.png",
            };
            contentView.AddChidren(btnFoorDownIcon);
//            #region 房间顶部切换显示区域
//            room = new Room() { roomName = Language.StringByID(StringId.All)};
//            btnFoorDownIcon = new Button()
//            {
//                Width = Application.GetMinRealAverage(16),
//                Height = Application.GetMinRealAverage(16),
//                X = Application.GetRealWidth(16),
//                Y = Application.GetRealHeight(18),
//                UnSelectedImagePath = "Public/DownIcon.png",
//            };
//            contentView.AddChidren(btnFoorDownIcon);
            
            btnRoom = new Button()
            {
                X = btnFoorDownIcon.Right,
                Y = Application.GetRealHeight(18),
                Width = Application.GetRealWidth(200),
                Height = Application.GetMinRealAverage(16),
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                TextAlignment = TextAlignment.CenterLeft,
                Text = room.roomName,
            };
            contentView.AddChidren(btnRoom);
//            btnRoom = new Button()
//            {
//                X = btnFoorDownIcon.Right,
//                Y = Application.GetRealHeight(18),
//                Width = Application.GetRealWidth(200),
//                Height = Application.GetMinRealAverage(16),
//                TextColor = CSS_Color.FirstLevelTitleColor,
//                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
//                TextAlignment = TextAlignment.CenterLeft,
//                Text = room.roomName,
//            };
//            contentView.AddChidren(btnRoom);
            btnRoomClickRow = new Button()
            {
                Height = Application.GetRealHeight(40),
            };
            contentView.AddChidren(btnRoomClickRow);
//            btnRoomClickRow = new Button()
//            {
//                Height = Application.GetRealHeight(40),
//            };
//            contentView.AddChidren(btnRoomClickRow);
            #endregion
//            #endregion
            sensorListView = new FrameLayout()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealHeight(50),
                Width = Application.GetRealWidth(308),
                Height = Application.GetRealHeight(456),
                Radius = (uint)Application.GetRealWidth(12),
                BorderColor = 0x00000000,
                BorderWidth = 0,
            };
            contentView.AddChidren(sensorListView);
//            sensorListView = new FrameLayout()
//            {
//                Gravity = Gravity.CenterHorizontal,
//                Y = Application.GetRealHeight(50),
//                Width = Application.GetRealWidth(308),
//                Height = Application.GetRealHeight(456),
//                Radius = (uint)Application.GetRealWidth(12),
//                BorderColor = 0x00000000,
//                BorderWidth = 0,
//            };
//            contentView.AddChidren(sensorListView);
            LoadSenesorList();
//            LoadSenesorList();
            LoadEventList();
//            LoadEventList();
            #endregion
//            #endregion
            //LoadEventList();
            LoadDialog_ChangeRoom();
//            //LoadEventList();
//            LoadDialog_ChangeRoom();
            new TopViewDiv(bodyView, Language.StringByID(StringId.EnvironmentalScience)).LoadTopView();
//            new TopViewDiv(bodyView, Language.StringByID(StringId.EnvironmentalScience)).LoadTopView();
        }
//        }
        /// <summary>
        /// 加载传感器列表
        /// </summary>
        void LoadSenesorList()
        {
            sensorListView.RemoveAll();
            int index = 0;
            foreach (var sensor in FunctionList.List.GetEnvirSensorsList())
            {
                LoadSensorDiv(sensor, index);
                index++;
            }
        }
//        /// <summary>
//        /// 加载传感器列表
//        /// </summary>
//        void LoadSenesorList()
//        {
//            sensorListView.RemoveAll();
//            int index = 0;
//            foreach (var sensor in FunctionList.List.GetEnvirSensorsList())
//            {
//                LoadSensorDiv(sensor, index);
//                index++;
//            }
//        }
        /// <summary>
        /// 加载传感器列表
        /// </summary>
        void LoadSensorDiv(Function sensor,int index)
        {
            var levelColorList = sensorTemp.GetLevelColorList(sensor.spk);
            var levelTextList = sensorTemp.GetLevelTextList(sensor.spk);
//        /// <summary>
//        /// 加载传感器列表
//        /// </summary>
//        void LoadSensorDiv(Function sensor,int index)
//        {
//            var levelColorList = sensorTemp.GetLevelColorList(sensor.spk);
//            var levelTextList = sensorTemp.GetLevelTextList(sensor.spk);
            if (room.roomId == "" ||  sensor.roomIds.Contains(room.roomId))
            {
                var sensorTag = sensor.sid;
                FrameLayout sensorView = new FrameLayout()
                {
                    Width = Application.GetRealWidth(148),
                    Height = Application.GetRealWidth(80),
                    Radius = (uint)Application.GetRealWidth(8),
                    BorderColor = 0x00000000,
                    BorderWidth = 0,
                    BackgroundColor = CSS_Color.MainBackgroundColor,
                    Y = Application.GetRealWidth(92 * (index / 2)),
                    Tag = sensorTag
                };
                if (index % 2 != 0)
                {
                    sensorView.X = Application.GetRealWidth(160);
                }
                sensorListView.AddChidren(sensorView);
//            if (room.roomId == "" ||  sensor.roomIds.Contains(room.roomId))
//            {
//                var sensorTag = sensor.sid;
//                FrameLayout sensorView = new FrameLayout()
//                {
//                    Width = Application.GetRealWidth(148),
//                    Height = Application.GetRealWidth(80),
//                    Radius = (uint)Application.GetRealWidth(8),
//                    BorderColor = 0x00000000,
//                    BorderWidth = 0,
//                    BackgroundColor = CSS_Color.MainBackgroundColor,
//                    Y = Application.GetRealWidth(92 * (index / 2)),
//                    Tag = sensorTag
//                };
//                if (index % 2 != 0)
//                {
//                    sensorView.X = Application.GetRealWidth(160);
//                }
//                sensorListView.AddChidren(sensorView);
                var arcBar = new DiyArcSeekBar()
                {
                    X = Application.GetRealWidth(7),
                    Gravity = Gravity.CenterVertical,
                    Width = Application.GetRealWidth(48),
                    Height = Application.GetRealWidth(48),
                    OpenAngle = 10,
                    ProgressBarColor = sensorTemp.GetLevelColorList(sensor.spk)[sensorTemp.GetCurLevel(sensor) - 1],
                    MinValue = 0,
                    MaxValue = 96,
                    Progress = (96 / sensorTemp.GetLevelColorList(sensor.spk).Count * sensorTemp.GetCurLevel(sensor)),
                    IsClickable = false,
                    ArcColor = CSS_Color.BackgroundColor,
                    ArcWidth = Application.GetRealWidth(4),
                    IsThumbImgBtnShow = false,
                    SeekBarPadding = Application.GetRealWidth(2),
                };
                sensorView.AddChidren(arcBar);
//                var arcBar = new DiyArcSeekBar()
//                {
//                    X = Application.GetRealWidth(7),
//                    Gravity = Gravity.CenterVertical,
//                    Width = Application.GetRealWidth(48),
//                    Height = Application.GetRealWidth(48),
//                    OpenAngle = 10,
//                    ProgressBarColor = sensorTemp.GetLevelColorList(sensor.spk)[sensorTemp.GetCurLevel(sensor) - 1],
//                    MinValue = 0,
//                    MaxValue = 96,
//                    Progress = (96 / sensorTemp.GetLevelColorList(sensor.spk).Count * sensorTemp.GetCurLevel(sensor)),
//                    IsClickable = false,
//                    ArcColor = CSS_Color.BackgroundColor,
//                    ArcWidth = Application.GetRealWidth(4),
//                    IsThumbImgBtnShow = false,
//                    SeekBarPadding = Application.GetRealWidth(2),
//                };
//                sensorView.AddChidren(arcBar);
                var btnSensorTitle = new Button()
                {
                    X = Application.GetRealWidth(7),
                    Gravity = Gravity.CenterVertical,
                    Width = Application.GetRealWidth(48),
                    Height = Application.GetRealWidth(48),
                    TextAlignment = TextAlignment.Center,
                    TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel,
                    TextColor = CSS_Color.FirstLevelTitleColor,
                    TextID = sensorTemp.GetFunctionTypeNameId(sensor.spk),
                    Tag = "SensorTitle"
                };
                sensorView.AddChidren(btnSensorTitle);
                btnSensorTitle.MouseUpEventHandler = (sender, e) => {
                    #region
                    var esp = new EnvironmentalSensorPage(sensor);
                    MainPage.BasePageView.AddChidren(esp);
                    esp.LoadPage();
                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                    #endregion
                };
//                var btnSensorTitle = new Button()
//                {
//                    X = Application.GetRealWidth(7),
//                    Gravity = Gravity.CenterVertical,
//                    Width = Application.GetRealWidth(48),
//                    Height = Application.GetRealWidth(48),
//                    TextAlignment = TextAlignment.Center,
//                    TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel,
//                    TextColor = CSS_Color.FirstLevelTitleColor,
//                    TextID = sensorTemp.GetFunctionTypeNameId(sensor.spk),
//                    Tag = "SensorTitle"
//                };
//                sensorView.AddChidren(btnSensorTitle);
//                btnSensorTitle.MouseUpEventHandler = (sender, e) => {
//                    #region
//                    var esp = new EnvironmentalSensorPage(sensor);
//                    MainPage.BasePageView.AddChidren(esp);
//                    esp.LoadPage();
//                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
//                    #endregion
//                };
                var btnInfoIcon = new Button()
                {
                    X = Application.GetRealWidth(120),
                    Width = Application.GetRealWidth(28),
                    Height = Application.GetRealWidth(28),
                    UnSelectedImagePath = "FunctionIcon/EnvironmentalScience/TipInfoIcon.png",
                };
                sensorView.AddChidren(btnInfoIcon);
                btnInfoIcon.MouseUpEventHandler = (sender, e) =>
                {
                    LoadInfo(sensor);
                };
//                var btnInfoIcon = new Button()
//                {
//                    X = Application.GetRealWidth(120),
//                    Width = Application.GetRealWidth(28),
//                    Height = Application.GetRealWidth(28),
//                    UnSelectedImagePath = "FunctionIcon/EnvironmentalScience/TipInfoIcon.png",
//                };
//                sensorView.AddChidren(btnInfoIcon);
//                btnInfoIcon.MouseUpEventHandler = (sender, e) =>
//                {
//                    LoadInfo(sensor);
//                };
                var btnSensorValues = new Button()
                {
                    X = Application.GetRealWidth(72),
                    Y = Application.GetRealWidth(17),
                    Width = Application.GetRealWidth(70),
                    Height = Application.GetRealWidth(30),
                    TextAlignment = TextAlignment.CenterLeft,
                    TextColor = CSS_Color.FirstLevelTitleColor,
                    TextSize = CSS_FontSize.EmphasisFontSize_Secondary,
                    IsBold = true,
                    Text = sensor.GetAttrState(FunctionAttributeKey.Value),
                    Tag = "SensorValues"
                };
                sensorView.AddChidren(btnSensorValues);
//                var btnSensorValues = new Button()
//                {
//                    X = Application.GetRealWidth(72),
//                    Y = Application.GetRealWidth(17),
//                    Width = Application.GetRealWidth(70),
//                    Height = Application.GetRealWidth(30),
//                    TextAlignment = TextAlignment.CenterLeft,
//                    TextColor = CSS_Color.FirstLevelTitleColor,
//                    TextSize = CSS_FontSize.EmphasisFontSize_Secondary,
//                    IsBold = true,
//                    Text = sensor.GetAttrState(FunctionAttributeKey.Value),
//                    Tag = "SensorValues"
//                };
//                sensorView.AddChidren(btnSensorValues);
                var btnLevel = new Button()
                {
                    X = Application.GetRealWidth(70),
                    Y = btnSensorValues.Bottom,
                    Width = Application.GetRealWidth(50),
                    Height = Application.GetRealWidth(18),
                    TextAlignment = TextAlignment.CenterLeft,
                    TextColor = levelColorList[sensorTemp.GetCurLevel( sensor) - 1],
                    TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel,
                    TextID = levelTextList[sensorTemp.GetCurLevel(sensor) - 1],
                    Tag = "SensorLevel"
                };
                sensorView.AddChidren(btnLevel);
//                var btnLevel = new Button()
//                {
//                    X = Application.GetRealWidth(70),
//                    Y = btnSensorValues.Bottom,
//                    Width = Application.GetRealWidth(50),
//                    Height = Application.GetRealWidth(18),
//                    TextAlignment = TextAlignment.CenterLeft,
//                    TextColor = levelColorList[sensorTemp.GetCurLevel( sensor) - 1],
//                    TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel,
//                    TextID = levelTextList[sensorTemp.GetCurLevel(sensor) - 1],
//                    Tag = "SensorLevel"
//                };
//                sensorView.AddChidren(btnLevel);
                Control.Ins.SendReadCommand(sensor);
            }
        }
//                Control.Ins.SendReadCommand(sensor);
//            }
//        }
        /// <summary>
        /// 加载传感器等级相关信息
        /// </summary>
        void LoadInfo(Function sensor)
        {
            var levelColorList = sensorTemp.GetLevelColorList(sensor.spk);
            var levelTextList = sensorTemp.GetLevelTextList(sensor.spk);
            Dialog dialog = new Dialog();
//        /// <summary>
//        /// 加载传感器等级相关信息
//        /// </summary>
//        void LoadInfo(Function sensor)
//        {
//            var levelColorList = sensorTemp.GetLevelColorList(sensor.spk);
//            var levelTextList = sensorTemp.GetLevelTextList(sensor.spk);
//            Dialog dialog = new Dialog();
            FrameLayout dialogBodyView = new FrameLayout();
            dialog.AddChidren(dialogBodyView);
            dialogBodyView.MouseUpEventHandler = (sender, e) =>
            {
                dialog.Close();
            };
            VerticalScrolViewLayout infoView = new VerticalScrolViewLayout()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealHeight(667 - 94 - (levelColorList.Count * 44) - 20),
                Width = Application.GetRealWidth(343),
                Height = Application.GetRealHeight(94 + (levelColorList.Count * 44) + levelColorList.Count),
                Radius = (uint)Application.GetRealWidth(12),
                BackgroundColor = CSS_Color.MainBackgroundColor,
                Animate = Animate.DownToUp,
                ScrollEnabled = false,
                AnimateSpeed = 0.3f,
            };
            dialogBodyView.AddChidren(infoView);
//            FrameLayout dialogBodyView = new FrameLayout();
//            dialog.AddChidren(dialogBodyView);
//            dialogBodyView.MouseUpEventHandler = (sender, e) =>
//            {
//                dialog.Close();
//            };
//            VerticalScrolViewLayout infoView = new VerticalScrolViewLayout()
//            {
//                Gravity = Gravity.CenterHorizontal,
//                Y = Application.GetRealHeight(667 - 94 - (levelColorList.Count * 44) - 20),
//                Width = Application.GetRealWidth(343),
//                Height = Application.GetRealHeight(94 + (levelColorList.Count * 44) + levelColorList.Count),
//                Radius = (uint)Application.GetRealWidth(12),
//                BackgroundColor = CSS_Color.MainBackgroundColor,
//                Animate = Animate.DownToUp,
//                ScrollEnabled = false,
//                AnimateSpeed = 0.3f,
//            };
//            dialogBodyView.AddChidren(infoView);
            Button btnTitle = new Button()
            {
                Height = Application.GetRealHeight(50),
                TextColor = CSS_Color.FirstLevelTitleColor,
                IsBold = true,
                TextSize = CSS_FontSize.SubheadingFontSize,
                TextAlignment = TextAlignment.Center,
            };
            infoView.AddChidren(btnTitle);
//            Button btnTitle = new Button()
//            {
//                Height = Application.GetRealHeight(50),
//                TextColor = CSS_Color.FirstLevelTitleColor,
//                IsBold = true,
//                TextSize = CSS_FontSize.SubheadingFontSize,
//                TextAlignment = TextAlignment.Center,
//            };
//            infoView.AddChidren(btnTitle);
            switch (sensor.spk)
            {
                case SPK.SensorPm25:
                    btnTitle.Text = "PM2.5(ug/m²)";
                    break;
                case SPK.SensorTemperature:
                    btnTitle.Text = Language.StringByID(StringId.Temp) + "(°C)";
                    break;
                case SPK.SensorTVOC:
                    btnTitle.Text = "TVOC(PPM)";
                    break;
                case SPK.SensorCO2:
                    btnTitle.Text = "CO2(PPM)";
                    break;
                case SPK.SensorHumidity:
                    btnTitle.Text = Language.StringByID(StringId.Humidity) + "(%)";
                    break;
            }
//            switch (sensor.spk)
//            {
//                case SPK.SensorPm25:
//                    btnTitle.Text = "PM2.5(ug/m²)";
//                    break;
//                case SPK.SensorTemperature:
//                    btnTitle.Text = Language.StringByID(StringId.Temp) + "(°C)";
//                    break;
//                case SPK.SensorTVOC:
//                    btnTitle.Text = "TVOC(PPM)";
//                    break;
//                case SPK.SensorCO2:
//                    btnTitle.Text = "CO2(PPM)";
//                    break;
//                case SPK.SensorHumidity:
//                    btnTitle.Text = Language.StringByID(StringId.Humidity) + "(%)";
//                    break;
//            }
            FrameLayout subTitleView = new FrameLayout()
            {
                Height = Application.GetRealHeight(44),
            };
            infoView.AddChidren(subTitleView);
//            FrameLayout subTitleView = new FrameLayout()
//            {
//                Height = Application.GetRealHeight(44),
//            };
//            infoView.AddChidren(subTitleView);
            subTitleView.AddChidren(new Button()
            {
                X = Application.GetRealWidth(20),
                Width = Application.GetRealWidth(100),
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.TextFontSize,
                IsBold = true,
                TextID = StringId.IntervalValue,
            });
//            subTitleView.AddChidren(new Button()
//            {
//                X = Application.GetRealWidth(20),
//                Width = Application.GetRealWidth(100),
//                TextAlignment = TextAlignment.CenterLeft,
//                TextColor = CSS_Color.FirstLevelTitleColor,
//                TextSize = CSS_FontSize.TextFontSize,
//                IsBold = true,
//                TextID = StringId.IntervalValue,
//            });
            subTitleView.AddChidren(new Button()
            {
                Gravity = Gravity.CenterHorizontal,
                Width = Application.GetRealWidth(100),
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.TextFontSize,
                IsBold = true,
                TextID = StringId.LevelSensor,
            });
//            subTitleView.AddChidren(new Button()
//            {
//                Gravity = Gravity.CenterHorizontal,
//                Width = Application.GetRealWidth(100),
//                TextAlignment = TextAlignment.Center,
//                TextColor = CSS_Color.FirstLevelTitleColor,
//                TextSize = CSS_FontSize.TextFontSize,
//                IsBold = true,
//                TextID = StringId.LevelSensor,
//            });
            subTitleView.AddChidren(new Button()
            {
                X = Application.GetRealWidth(223),
                Width = Application.GetRealWidth(100),
                TextAlignment = TextAlignment.CenterRight,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.TextFontSize,
                IsBold = true,
                TextID = StringId.ColorValue,
            });
            for (int index = 0; index < levelTextList.Count; index++)
            {
                infoView.AddChidren(new Button()
                {
                    Gravity = Gravity.CenterHorizontal,
                    Width = Application.GetRealWidth(303),
                    Height = Application.GetRealWidth(1),
                    BackgroundColor = CSS_Color.DividingLineColor,
                });
//            subTitleView.AddChidren(new Button()
//            {
//                X = Application.GetRealWidth(223),
//                Width = Application.GetRealWidth(100),
//                TextAlignment = TextAlignment.CenterRight,
//                TextColor = CSS_Color.FirstLevelTitleColor,
//                TextSize = CSS_FontSize.TextFontSize,
//                IsBold = true,
//                TextID = StringId.ColorValue,
//            });
//            for (int index = 0; index < levelTextList.Count; index++)
//            {
//                infoView.AddChidren(new Button()
//                {
//                    Gravity = Gravity.CenterHorizontal,
//                    Width = Application.GetRealWidth(303),
//                    Height = Application.GetRealWidth(1),
//                    BackgroundColor = CSS_Color.DividingLineColor,
//                });
                FrameLayout subInfoView = new FrameLayout()
                {
                    Height = Application.GetRealHeight(44),
                };
                infoView.AddChidren(subInfoView);
//                FrameLayout subInfoView = new FrameLayout()
//                {
//                    Height = Application.GetRealHeight(44),
//                };
//                infoView.AddChidren(subInfoView);
                subInfoView.AddChidren(new Button()
                {
                    X = Application.GetRealWidth(20),
                    Width = Application.GetRealWidth(100),
                    TextAlignment = TextAlignment.CenterLeft,
                    TextColor = CSS_Color.FirstLevelTitleColor,
                    TextSize = CSS_FontSize.TextFontSize,
                    IsBold = true,
                    Text = sensorTemp.GetIntervalValue(sensor.spk)[index]
                });
//                subInfoView.AddChidren(new Button()
//                {
//                    X = Application.GetRealWidth(20),
//                    Width = Application.GetRealWidth(100),
//                    TextAlignment = TextAlignment.CenterLeft,
//                    TextColor = CSS_Color.FirstLevelTitleColor,
//                    TextSize = CSS_FontSize.TextFontSize,
//                    IsBold = true,
//                    Text = sensorTemp.GetIntervalValue(sensor.spk)[index]
//                });
                subInfoView.AddChidren(new Button()
                {
                    Gravity = Gravity.CenterHorizontal,
                    Width = Application.GetRealWidth(100),
                    TextAlignment = TextAlignment.Center,
                    TextColor = CSS_Color.FirstLevelTitleColor,
                    TextSize = CSS_FontSize.TextFontSize,
                    IsBold = true,
                    TextID = levelTextList[index]
                });
//                subInfoView.AddChidren(new Button()
//                {
//                    Gravity = Gravity.CenterHorizontal,
//                    Width = Application.GetRealWidth(100),
//                    TextAlignment = TextAlignment.Center,
//                    TextColor = CSS_Color.FirstLevelTitleColor,
//                    TextSize = CSS_FontSize.TextFontSize,
//                    IsBold = true,
//                    TextID = levelTextList[index]
//                });
                subInfoView.AddChidren(new Button()
                {
                    X = Application.GetRealWidth(285),
                    Gravity = Gravity.CenterVertical,
                    Width = Application.GetRealWidth(38),
                    Height = Application.GetRealHeight(18),
                    Radius = (uint)Application.GetRealWidth(4),
                    BackgroundColor = levelColorList[index]
                });
            }
//                subInfoView.AddChidren(new Button()
//                {
//                    X = Application.GetRealWidth(285),
//                    Gravity = Gravity.CenterVertical,
//                    Width = Application.GetRealWidth(38),
//                    Height = Application.GetRealHeight(18),
//                    Radius = (uint)Application.GetRealWidth(4),
//                    BackgroundColor = levelColorList[index]
//                });
//            }
            dialog.Show();
        }
//            dialog.Show();
//        }
        /// <summary>
        /// 房间列表点击事件
        /// </summary>
        void LoadDialog_ChangeRoom()
        {
            EventHandler<MouseEventArgs> eventHandler = (sender, e) => {
                var dialog = new Dialog();
                var dialogBody = new FrameLayout();
                dialog.AddChidren(dialogBody);
                dialogBody.MouseUpEventHandler += (sender1, e1) => {
                    dialog.Close();
                };
//        /// <summary>
//        /// 房间列表点击事件
//        /// </summary>
//        void LoadDialog_ChangeRoom()
//        {
//            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(266),
                    Width = Application.GetRealWidth(160),
                    Height = Application.GetRealHeight(110),
                    BackgroundImagePath = "PersonalCenter/HomeList1bg.png",
                };
                dialogBody.AddChidren(dispalyView);
//                var dispalyView = new FrameLayout()
//                {
//                    X = Application.GetRealWidth(10),
//                    Y = Application.GetRealHeight(266),
//                    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);
//                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(266),
                        Width = Application.GetRealWidth(160),
                        Height = Application.GetRealHeight(155),
                        BackgroundImagePath = "PersonalCenter/HomeList2bg.png",
                    };
                    dialogBody.AddChidren(dispalyView);
//                if (SpatialInfo.CurrentSpatial.RoomList.Count < 2)
//                {
//                }
//                else if (SpatialInfo.CurrentSpatial.RoomList.Count < 3)
//                {
//                    dispalyView = new FrameLayout()
//                    {
//                        X = Application.GetRealWidth(10),
//                        Y = Application.GetRealHeight(266),
//                        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(266),
                        Width = Application.GetRealWidth(160),
                        Height = Application.GetRealHeight(200),
                        BackgroundImagePath = "PersonalCenter/HomeList3bg.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(266),
//                        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(266),
                        Width = Application.GetRealWidth(160),
                        Height = Application.GetRealHeight(245),
                        BackgroundImagePath = "PersonalCenter/HomeList4bg.png",
                    };
                    dialogBody.AddChidren(dispalyView);
//                    contentView.Height = Application.GetRealHeight(45 * 4);
//                    dispalyView.AddChidren(contentView);
//                }
//                else
//                {
//                    dispalyView = new FrameLayout()
//                    {
//                        X = Application.GetRealWidth(10),
//                        Y = Application.GetRealHeight(266),
//                        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);
                }
//                    contentView.Height = Application.GetRealHeight(45 * 5);
//                    contentView.ScrollEnabled = true;
//                    dispalyView.AddChidren(contentView);
//                }
                var showListRoom = new List<Room>();
                showListRoom.Add(new Room() { roomName = Language.StringByID(StringId.All) });
                showListRoom.AddRange(SpatialInfo.CurrentSpatial.RoomList);
//                var showListRoom = new List<Room>();
//                showListRoom.Add(new Room() { roomName = Language.StringByID(StringId.All) });
//                showListRoom.AddRange(SpatialInfo.CurrentSpatial.RoomList);
                foreach (var roomTemp in showListRoom)
                {
                    string roomName = roomTemp.roomName;
                    var btnRoomName = 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 = roomName,
                        TextSize = CSS.CSS_FontSize.SubheadingFontSize,
                        IsSelected = btnRoom.Text == roomName,
                        IsMoreLines = true,
                        Tag = roomName
                    };
                    contentView.AddChidren(btnRoomName);
//                foreach (var roomTemp in showListRoom)
//                {
//                    string roomName = roomTemp.roomName;
//                    var btnRoomName = 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 = roomName,
//                        TextSize = CSS.CSS_FontSize.SubheadingFontSize,
//                        IsSelected = btnRoom.Text == roomName,
//                        IsMoreLines = true,
//                        Tag = roomName
//                    };
//                    contentView.AddChidren(btnRoomName);
                    btnRoomName.MouseUpEventHandler += (senderH, en) =>
                    {
                        dialog.Close();
                        btnRoom.Text = roomName;
                        room = roomTemp;
                        LoadSenesorList();
                    };
                }
//                    btnRoomName.MouseUpEventHandler += (senderH, en) =>
//                    {
//                        dialog.Close();
//                        btnRoom.Text = roomName;
//                        room = roomTemp;
//                        LoadSenesorList();
//                    };
//                }
                dialog.Show();
            };
//                dialog.Show();
//            };
            btnRoomClickRow.MouseUpEventHandler = eventHandler;
            //btnFoorDownIcon.MouseUpEventHandler = eventHandler;
        }
//            btnRoomClickRow.MouseUpEventHandler = eventHandler;
//            //btnFoorDownIcon.MouseUpEventHandler = eventHandler;
//        }
    }
}
//    }
//}