From 002bb6950a15e703e2ad6ef7b2b4c5d80c4ee64b Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期一, 22 三月 2021 17:56:07 +0800
Subject: [PATCH] 2021-3-22-2

---
 HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs |  933 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 933 insertions(+), 0 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs
new file mode 100644
index 0000000..f48dad4
--- /dev/null
+++ b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalPage.cs
@@ -0,0 +1,933 @@
+锘縰sing System;
+using System.Collections.Generic;
+using HDL_ON.DriverLayer;
+using HDL_ON.Entity;
+using HDL_ON.UI.CSS;
+using Shared;
+
+namespace HDL_ON.UI
+{
+    public class EnvironmentalPage : FrameLayout
+    {
+
+        #region 鎺т欢闆嗗悎
+        static EnvironmentalPage 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;
+
+        #endregion
+        #region 鍖哄煙鍙橀噺
+        Room room;
+
+        Sensor sensorTemp = new Sensor();
+        #endregion
+
+
+        public EnvironmentalPage()
+        {
+            bodyView = this;
+        }
+
+        /// <summary>
+        /// 鍔犺浇鐣岄潰
+        /// </summary>
+        /// <param name="btnCollectionIcon">鏀惰棌鎸夐挳</param>
+        /// <param name="btnFunctionName">鍔熻兘鍚嶇О淇℃伅鎸夐挳</param>
+        /// <param name="btnFromFloor">鍔熻兘妤煎眰淇℃伅鎸夐挳</param>
+        public void LoadPage()
+        {
+            bodyView.BackgroundColor = CSS_Color.BackgroundColor;
+
+            #region 椤堕儴澶╂皵閮ㄥ垎
+            var topWeatherView = new FrameLayout()
+            {
+                Gravity = Gravity.CenterHorizontal,
+                Y = Application.GetRealHeight(73),
+                Width = Application.GetRealWidth(361),
+                Height = Application.GetRealWidth(166),
+                BackgroundImagePath = "FunctionIcon/EnvirSensor/0.png",
+            };
+            bodyView.AddChidren(topWeatherView);
+            LoadEvent_ChangeWeatherIcon(topWeatherView);
+
+            var btnLocationText = new Button()
+            {
+                X = Application.GetRealWidth(27),
+                Width = Application.GetRealWidth(74),
+                Height = Application.GetRealWidth(44),
+                TextAlignment = TextAlignment.CenterLeft,
+                TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel,
+                TextColor = CSS_Color.FirstLevelTitleColor,
+                Text = MainPage.cityInfo.location,
+            };
+            topWeatherView.AddChidren(btnLocationText);
+
+
+            var btnTemp = new Button()
+            {
+                X = Application.GetRealWidth(21),
+                Y = Application.GetRealWidth(53),
+                Width = Application.GetRealWidth(78),
+                Height = Application.GetRealWidth(68),
+                TextSize = 60,
+                IsBold = true,
+                TextAlignment = TextAlignment.CenterLeft,
+                TextColor = CSS_Color.FirstLevelTitleColor,
+                Text = MainPage.cityInfo.temperature,
+            };
+            topWeatherView.AddChidren(btnTemp);
+
+            var btnTempUint = new Button()
+            {
+                X = Application.GetRealWidth(109),
+                Y = Application.GetRealWidth(60),
+                Width = Application.GetRealWidth(20),
+                Height = Application.GetRealWidth(20),
+                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+                TextColor = CSS_Color.TextualColor,
+                Text = "掳C",
+            };
+            topWeatherView.AddChidren(btnTempUint);
+
+
+            btnWatherText = new Button()
+            {
+                X = Application.GetRealWidth(109),
+                Y = Application.GetRealWidth(82),
+                Width = Application.GetRealWidth(200),
+                Height = Application.GetRealWidth(20),
+                TextColor = CSS_Color.TextualColor,
+                TextSize = CSS_FontSize.TextFontSize,
+                TextAlignment = TextAlignment.CenterLeft,
+                Text = MainPage.cityInfo.weather
+            };
+            topWeatherView.AddChidren(btnWatherText);
+
+            var btnTempUpperLimit = new Button()
+            {
+                X = Application.GetRealWidth(107),
+                Y = Application.GetRealWidth(101),
+                Width = Application.GetRealWidth(16),
+                Height = Application.GetRealWidth(16),
+                UnSelectedImagePath = "FunctionIcon/EnvirSensor/UpperLimit.png",
+            };
+            topWeatherView.AddChidren(btnTempUpperLimit);
+
+            var btnTempUpperLimitText = new Button()
+            {
+                X = btnTempUpperLimit.Right,
+                Y = Application.GetRealWidth(101),
+                Width = Application.GetRealWidth(42),
+                Height = Application.GetRealWidth(20),
+                TextColor = CSS_Color.TextualColor,
+                TextAlignment = TextAlignment.CenterLeft,
+                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+                Text = "10掳C",
+            };
+            topWeatherView.AddChidren(btnTempUpperLimitText);
+
+            var btnTempLowerLimit = new Button()
+            {
+                X = Application.GetRealWidth(156),
+                Y = Application.GetRealWidth(101),
+                Width = Application.GetRealWidth(16),
+                Height = Application.GetRealWidth(16),
+                UnSelectedImagePath = "FunctionIcon/EnvirSensor/LowerLimit.png",
+            };
+            topWeatherView.AddChidren(btnTempLowerLimit);
+
+            var btnTempLowerLimitText = new Button()
+            {
+                X = btnTempLowerLimit.Right,
+                Y = Application.GetRealWidth(101),
+                Width = Application.GetRealWidth(42),
+                Height = Application.GetRealWidth(20),
+                TextColor = CSS_Color.TextualColor,
+                TextAlignment = TextAlignment.CenterLeft,
+                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+                Text = "2掳C",
+            };
+            topWeatherView.AddChidren(btnTempLowerLimitText);
+
+
+            var btnValue = new Button()
+            {
+                X = Application.GetRealWidth(27),
+                Y = Application.GetRealWidth(119),
+                Width = Application.GetRealWidth(300),
+                Height = Application.GetRealWidth(34),
+                TextAlignment = TextAlignment.CenterLeft,
+                TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel,
+                TextColor = CSS_Color.TextualColor,
+            };
+            topWeatherView.AddChidren(btnValue);
+            var valueText = Language.StringByID(StringId.EnvirSensorValueTip);
+            btnValue.Text = valueText.Replace("{0}", $"{MainPage.cityInfo.humidity}").Replace("{1}", $"{MainPage.cityInfo.pm25}").Replace("{2}", $"{MainPage.cityInfo.windLevel}");
+            #endregion
+
+            #region contentView
+            FrameLayout contentView = new FrameLayout()
+            {
+                Gravity = Gravity.CenterHorizontal,
+                Y = Application.GetRealWidth(239),
+                Height = Application.GetRealHeight(450),
+            };
+            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);
+
+            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);
+
+            #endregion
+
+            sensorListView = new FrameLayout()
+            {
+                Gravity = Gravity.CenterHorizontal,
+                Y = Application.GetRealHeight(50),
+                Height = Application.GetRealHeight(456),
+                Radius = (uint)Application.GetRealWidth(12),
+                BorderColor = 0x00000000,
+                BorderWidth = 0,
+            };
+            contentView.AddChidren(sensorListView);
+
+            LoadSenesorList();
+
+
+
+            #endregion
+
+            //LoadEventList();
+            LoadDialog_ChangeRoom();
+
+            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 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()
+                {
+                    X = Application.GetRealWidth(7),
+                    Width = Application.GetRealWidth(182),
+                    Height = Application.GetRealWidth(124),
+                    Y = Application.GetRealWidth(124 * (index / 2)),
+                    Tag = sensorTag
+                };
+
+                var imagePath = "";
+                var iconPath = "";
+                switch (sensor.spk)
+                {
+                    case SPK.SensorCO2:
+                        imagePath = "FunctionIcon/EnvirSensor/Co2Bg.png";
+                        iconPath = "FunctionIcon/EnvirSensor/Co2Icon.png";
+                        break;
+                    case SPK.SensorPm25:
+                        imagePath = "FunctionIcon/EnvirSensor/Pm25Bg.png";
+                        iconPath = "FunctionIcon/EnvirSensor/Pm25Icon.png";
+                        break;
+                    case SPK.SensorTVOC:
+                        imagePath = "FunctionIcon/EnvirSensor/TvocBg.png";
+                        iconPath = "FunctionIcon/EnvirSensor/TvocIcon.png";
+                        break;
+                    case SPK.SensorHumidity:
+                        imagePath = "FunctionIcon/EnvirSensor/HumidityBg.png";
+                        iconPath = "FunctionIcon/EnvirSensor/HumidityIcon.png";
+                        break;
+                    case SPK.SensorTemperature:
+                        imagePath = "FunctionIcon/EnvirSensor/TempBg.png";
+                        iconPath = "FunctionIcon/EnvirSensor/TempIcon.png";
+                        break;
+                }
+                sensorView.BackgroundImagePath = imagePath;
+
+                if (index % 2 != 0)
+                {
+                    sensorView.X = Application.GetRealWidth(189);
+                }
+                sensorListView.AddChidren(sensorView);
+
+                var btnIcon = new Button()
+                {
+                    X = Application.GetRealWidth(23),
+                    Y = Application.GetRealHeight(17),
+                    Width = Application.GetRealWidth(32),
+                    Height = Application.GetRealWidth(32),
+                    UnSelectedImagePath = iconPath
+                };
+                sensorView.AddChidren(btnIcon);
+
+                btnIcon.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(139),
+                    Y = Application.GetRealHeight(21),
+                    Width = Application.GetRealWidth(24),
+                    Height = Application.GetRealWidth(24),
+                    UnSelectedImagePath = "FunctionIcon/EnvirSensor/InfoIcon.png",
+                };
+                sensorView.AddChidren(btnInfoIcon);
+                btnInfoIcon.MouseUpEventHandler = (sender, e) =>
+                {
+                    LoadInfo(sensor);
+                };
+
+                var btnLevel = new Button()
+                {
+                    X = Application.GetRealWidth(25),
+                    Y = Application.GetRealWidth(59),
+                    Width = Application.GetRealWidth(100),
+                    Height = Application.GetRealWidth(32),
+                    TextAlignment = TextAlignment.CenterLeft,
+                    TextColor = CSS_Color.FirstLevelTitleColor,//levelColorList[sensorTemp.GetCurLevel(sensor) - 1],
+                    TextSize = CSS_FontSize.SubheadingFontSize,
+                    TextID = levelTextList[sensorTemp.GetCurLevel(sensor) - 1],
+                    Tag = "SensorLevel",
+                };
+                sensorView.AddChidren(btnLevel);
+                btnLevel.MouseUpEventHandler = (sender, e) =>
+                {
+                    #region 
+                    var esp = new EnvironmentalSensorPage(sensor);
+                    MainPage.BasePageView.AddChidren(esp);
+                    esp.LoadPage();
+                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                    #endregion
+                };
+
+
+                var btnSensorValues = new Button()
+                {
+                    X = Application.GetRealWidth(25),
+                    Y = Application.GetRealWidth(83),
+                    Width = Application.GetRealWidth(100),
+                    Height = Application.GetRealWidth(27),
+                    TextAlignment = TextAlignment.CenterLeft,
+                    TextColor = CSS_Color.PromptingColor1,
+                    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+                    IsBold = true,
+                    Text = sensor.GetAttrState(FunctionAttributeKey.Value),
+                    Tag = "SensorValues"
+                };
+                sensorView.AddChidren(btnSensorValues);
+                btnSensorValues.MouseUpEventHandler = (sender, e) =>
+                {
+                    #region 
+                    var esp = new EnvironmentalSensorPage(sensor);
+                    MainPage.BasePageView.AddChidren(esp);
+                    esp.LoadPage();
+                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                    #endregion
+                };
+                //btnLevel.MouseUpEventHandler = (sender, e) =>
+                //{
+                //    LoadInfo(sensor);
+                //};
+
+
+
+                new System.Threading.Thread(() =>
+                {
+                    Control.Ins.SendReadCommand(sensor);
+                })
+                { IsBackground = true }.Start();
+            }
+        }
+
+        /// <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);
+
+            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;
+            }
+
+            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()
+            {
+                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,
+                });
+
+                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()
+                {
+                    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]
+                });
+            }
+
+
+
+
+            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();
+                };
+
+                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);
+
+                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 * 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);
+                }
+
+
+                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_Color.FirstLevelTitleColor,
+                        SelectedTextColor = CSS_Color.MainColor,
+                        Text = roomName,
+                        TextSize = 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();
+                    };
+                }
+
+                dialog.Show();
+            };
+
+            btnRoomClickRow.MouseUpEventHandler = eventHandler;
+            //btnFoorDownIcon.MouseUpEventHandler = eventHandler;
+        }
+
+
+
+
+
+        #region event
+
+        public static void LoadEvent_UpdataStatus(Function updateTemp)
+        {
+            Application.RunOnMainThread(() =>
+            {
+                if (bodyView != null)
+                {
+                    for (int i = 0; i < bodyView.sensorListView.ChildrenCount; i++)
+                    {
+                        var sensorTag = updateTemp.sid;
+                        var view = bodyView.sensorListView.GetChildren(i);
+                        if (view.GetType() == typeof(FrameLayout))
+                        {
+                            if (view.Tag.ToString() != sensorTag)
+                            {
+                                continue;
+                            }
+                            for (int j = 0; j < (view as FrameLayout).ChildrenCount; j++)
+                            {
+                                var btn = (view as FrameLayout).GetChildren(j);
+                                if (btn.GetType() == typeof(Button))
+                                {
+                                    if (btn.Tag != null)
+                                    {
+                                        var tag = btn.Tag.ToString();
+                                        if (tag == "SensorValues")
+                                        {
+                                            (btn as Button).Text = updateTemp.GetAttrState(FunctionAttributeKey.Value);
+                                        }
+                                        else if (tag == "SensorLevel")
+                                        {
+                                            (btn as Button).TextID = bodyView.sensorTemp.GetLevelTextList(updateTemp.spk)[bodyView.sensorTemp.GetCurLevel(updateTemp) - 1];
+                                            (btn as Button).TextColor = bodyView.sensorTemp.GetLevelColorList(updateTemp.spk)[bodyView.sensorTemp.GetCurLevel(updateTemp) - 1];
+                                        }
+                                    }
+                                }
+                                else if (btn.GetType() == typeof(ArcSeekBar))
+                                {
+                                    (btn as ArcSeekBar).ProgressBarColor = bodyView.sensorTemp.GetLevelColorList(updateTemp.spk)[bodyView.sensorTemp.GetCurLevel(updateTemp) - 1];
+
+                                    (btn as ArcSeekBar).Progress = (96 / bodyView.sensorTemp.GetLevelColorList(updateTemp.spk).Count) * bodyView.sensorTemp.GetCurLevel(updateTemp);
+                                }
+                            }
+                        }
+                    }
+                }
+            });
+        }
+
+        void LoadEvent_ChangeWeatherIcon(FrameLayout view)
+        {
+
+            switch (MainPage.cityInfo.weather)
+            {
+                case "鏅�":
+                case "Sunny":
+                case "鏅村ぉ":
+                case "澶╂櫞":
+                case "Clear":
+                case "澶ч儴鏅存湕":
+                case "Mostly Sunny":
+                case "鏅存檪澶氶洸":
+                case "闄藉厜鍏呮矝":
+                case "Mostly Clear":
+                    view.BackgroundImagePath = "FunctionIcon/EnvirSensor/0.png";
+                    break;
+                case "澶氫簯":
+                case "Cloudy":
+                case "澶氶洸":
+                case "灏戜簯":
+                case "Partly Cloudy":
+                case "灏戦洸":
+                    view.BackgroundImagePath = "FunctionIcon/EnvirSensor/1.png";
+                    break;
+                case "闃�":
+                case "Overcast":
+                case "闄板ぉ":
+                    view.BackgroundImagePath = "FunctionIcon/EnvirSensor/2.png";
+                    break;
+                case "闃甸洦":
+                case "Showers":
+                case "闄i洦":
+                case "椹熼洦":
+                case "灞�閮ㄩ樀闆�":
+                case "Scattered Showers":
+                case "灞�鍦伴櫍闆�":
+                case "灞�閮ㄥ湴鍗�鎬ч闆�":
+                case "灏忛樀闆�":
+                case "Light Showers":
+                case "灏忛櫍闆�":
+                case "闆舵暎椹熼洦":
+                case "寮洪樀闆�":
+                case "Heavy Showers":
+                case "寮烽櫍闆�":
+                case "闁撲腑鏈夐闆�":
+                    view.BackgroundImagePath = "FunctionIcon/EnvirSensor/3.png";
+                    break;
+                case "闃甸洩":
+                case "Snow Showers":
+                case "闄i洩":
+                case "椹熼洩":
+                case "灏忛樀闆�":
+                case "Light Snow Showers":
+                case "灏忛櫍闆�":
+                case "闆舵暎椹熼洩":
+                    view.BackgroundImagePath = "FunctionIcon/EnvirSensor/13.png";
+                    break;
+                case "闆�":
+                case "Fog":
+                case "闇�":
+                case "钖勯湩":
+                case "鍐婚浘":
+                case "Freezing Fog":
+                case "鍑嶉湩":
+                    view.BackgroundImagePath = "FunctionIcon/EnvirSensor/18.png";
+                    break;
+                case "娌欏皹鏆�":
+                case "Sandstorm":
+                case "娌欏〉鏆�":
+                case "寮烘矙灏樻毚":
+                case "Heavy Sandstorm":
+                case "寮锋矙濉垫毚":
+                    view.BackgroundImagePath = "FunctionIcon/EnvirSensor/20.png";
+                    break;
+                case "娴皹":
+                case "Dust":
+                case "娴〉":
+                case "灏樺嵎椋�":
+                case "Dust Storm":
+                case "濉垫嵅棰�":
+                case "鎵矙":
+                case "Sand":
+                case "鎻氭矙":
+                    view.BackgroundImagePath = "FunctionIcon/EnvirSensor/29.png";
+                    break;
+                case "闇�":
+                case "Haze":
+                case "鐓欓湠":
+                    view.BackgroundImagePath = "FunctionIcon/EnvirSensor/45.png";
+                    break;
+                case "闆烽樀闆�":
+                case "Thundershower":
+                case "闆烽櫍闆�":
+                case "闆烽洦":
+                case "闆风數":
+                case "Lightning":
+                case "闆烽浕":
+                case "闆锋毚":
+                case "Thunderstorm":
+                    view.BackgroundImagePath = "FunctionIcon/EnvirSensor/4.png";
+                    break;
+                case "闆烽樀闆ㄤ即鏈夊啺闆�":
+                case "Thundershower with Hail":
+                case "闆烽櫍闆ㄤ即鏈夊啺闆�":
+                case "闆烽洦浼存湁鍐伴浌":
+                case "鍐伴浌":
+                case "Hail":
+                case "鍐伴拡":
+                case "Needle Ice":
+                case "鍐伴嚌":
+                case "鍐扮矑":
+                case "Icy":
+                    view.BackgroundImagePath = "FunctionIcon/EnvirSensor/5.png";
+                    break;
+                case "闆ㄥす闆�":
+                case "Sleet":
+                case "闆ㄥぞ闆�":
+                    view.BackgroundImagePath = "FunctionIcon/EnvirSensor/6.png";
+                    break;
+                case "灏忛洦":
+                case "Light Rain":
+                    view.BackgroundImagePath = "FunctionIcon/EnvirSensor/3.png";
+                    break;
+                case "涓洦":
+                case "Rain":
+                case "灏忓埌涓洦":
+                case "闆�":
+                    view.BackgroundImagePath = "FunctionIcon/EnvirSensor/3.png";
+                    break;
+                case "澶ч洦":
+                case "Heavy Rain":
+                case "涓埌澶ч洦":
+                    view.BackgroundImagePath = "FunctionIcon/EnvirSensor/3.png";
+                    break;
+                case "鏆撮洦":
+                case "Rainstorm":
+                case "璞洦":
+                case "澶ф毚闆�":
+                case "Heavy Rainstorm":
+                case "澶ц豹闆�":
+                case "鐗瑰ぇ鏆撮洦":
+                case "Extreme Rainstorm":
+                case "瓒呭ぇ璞洦":
+                case "澶у埌鏆撮洦":
+                    view.BackgroundImagePath = "FunctionIcon/EnvirSensor/3.png";
+                    break;
+                case "灏忛洩":
+                case "Light Snow":
+                    view.BackgroundImagePath = "FunctionIcon/EnvirSensor/13.png";
+                    break;
+                case "闆�":
+                case "涓洩":
+                case "灏忓埌涓洩":
+                case "Snow":
+                    view.BackgroundImagePath = "FunctionIcon/EnvirSensor/13.png";
+                    break;
+                case "澶ч洩":
+                case "Heavy Snow":
+                    view.BackgroundImagePath = "FunctionIcon/EnvirSensor/13.png";
+                    break;
+                case "鏆撮洩":
+                case "Blizzard":
+                    view.BackgroundImagePath = "FunctionIcon/EnvirSensor/13.png";
+                    break;
+                case "鍐婚洦":
+                case "Freezing Rain":
+                case "鍑嶉洦":
+                    view.BackgroundImagePath = "FunctionIcon/EnvirSensor/6.png";
+                    break;
+            }
+        }
+
+        #endregion
+    }
+}

--
Gitblit v1.8.0