//using 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 A_EnvironmentalDataCenter : FrameLayout // { // #region 控件集合 // static A_EnvironmentalDataCenter bodyView; // /// // /// 楼层显示 // /// // Button btnRoom; // /// // /// 房间选择下拉图标 // /// // Button btnFoorDownIcon; // /// // /// 房间选择触发区域 // /// // Button btnRoomClickRow; // /// // /// 传感器列表区域 // /// // FrameLayout sensorListView; // VerticalScrolViewLayout sensorListContentView; // /// // /// 天气名称文本 // /// // Button btnWatherText; // /// // /// 湿度数据文本 // /// // Button btnHumidityText; // /// // /// pm25数据文本 // /// // Button btnPm25Values; // /// // /// 风速数据文本 // /// // Button btnFanSpeedValues; // List sensorViewList = new List(); // #endregion // #region 区域变量 // Room room; // Sensor sensorTemp = new Sensor(); // /// // /// 传感器分类列表 // /// // Dictionary> sensorList = new Dictionary>(); // #endregion // public A_EnvironmentalDataCenter() // { // bodyView = this; // } // /// // /// 加载界面 // /// // /// 收藏按钮 // /// 功能名称信息按钮 // /// 功能楼层信息按钮 // 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 = $"{MainPage.cityInfo.highestTemperature}°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 = $"{MainPage.cityInfo.lowestTemperature}°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 // sensorListContentView = new VerticalScrolViewLayout() // { // Gravity = Gravity.CenterHorizontal, // Y = Application.GetRealHeight(50), // Height = Application.GetRealHeight(400), // Radius = (uint)Application.GetRealWidth(12), // BorderColor = 0x00000000, // BorderWidth = 0, // }; // contentView.AddChidren(sensorListContentView); // sensorListView = new FrameLayout(); // sensorListContentView.AddChidren(sensorListView); // LoadSenesorList(); // #endregion // //LoadEventList(); // LoadDialog_ChangeRoom(); // new TopViewDiv(bodyView, Language.StringByID(StringId.EnvironmentalScience)).LoadTopView(); // } // /// // /// 加载传感器列表 // /// // void LoadSenesorList() // { // sensorListView.RemoveAll(); // sensorViewList.Clear(); // sensorList = new Dictionary>(); // int index = 0; // foreach (var sensor in FunctionList.List.GetEnvirSensorsList()) // { // foreach (var sensorAttr in sensor.attributes) // { // if (SPK.EnvironSpkList().Contains(sensorAttr.key) || sensorAttr.key == "value") // { // var flag = sensorAttr.key; // if (flag == "value") // { // flag = sensor.spk.Replace("sensor.", ""); // } // var newTemp = new Function() // { // name = sensor.name, // sid = sensor.sid, // deviceId = sensor.deviceId, // roomIds = sensor.roomIds, // spk = "sensor."+ flag, // attributes = new List { new FunctionAttributes { key = "value", state = sensorAttr.state, curValue = sensorAttr.curValue } // , new FunctionAttributes {key = "spk",state = sensorAttr.key,curValue = sensorAttr.key } } // }; // //分类加入集合 // if (sensorList.ContainsKey(flag)) // { // sensorList[flag].Add(newTemp); // } // else // { // sensorList.Add(flag, new List() { newTemp }); // } // } // } // new System.Threading.Thread(() => // { // Control.Ins.SendReadCommand(sensor); // }) // { IsBackground = true }.Start(); // } // foreach(var sensorAssemble in sensorList) // { // var showList = sensorAssemble.Value; // if(room.roomId != "") // { // showList = sensorAssemble.Value.FindAll((obj) => obj.roomIds.Contains(room.roomId)); // } // if (showList != null && showList.Count > 0) // { // var sensorView = new SensorView(showList,index); // sensorListView.AddChidren(sensorView); // sensorViewList.Add(sensorView); // sensorView.LoadView(); // index++; // } // } // sensorListView.Height = Application.GetRealWidth(124 * (index + 1) / 2); // } // /// // /// 房间列表点击事件 // /// // void LoadDialog_ChangeRoom() // { // EventHandler 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(); // 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(() => // { // try // { // if (bodyView != null) // { // foreach (var sensorAttr in updateTemp.attributes) // { // if (SPK.EnvironSpkList().Contains(sensorAttr.key) || sensorAttr.key == "value") // { // var flag = sensorAttr.key; // if (flag == "value") // { // flag = updateTemp.spk.Replace("sensor.", ""); // } // foreach (var view in bodyView.sensorViewList) // { // if (view.Tag.ToString() == flag) // { // view.UpdataStatus(flag,updateTemp.sid, sensorAttr.state); // } // } // } // } // } // } // catch (Exception ex) // { // MainPage.Log($"更新环境传感器界面异常:{ex.Message}"); // } // }); // } // 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 "陣雨": // 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 "陣雪": // 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 // } // /// // /// 加载传感器列表 // /// // public class SensorView :FrameLayout // { // Button btnSensorValues; // Button btnLevel; // List sensorList = new List(); // string imagePath = ""; // string iconPath = ""; // string sensorSPK = ""; // Sensor sensorTemp = new Sensor(); // double assembleValues = 0.0; // public SensorView(List showList, int index)//,,string spk,double value) // { // sensorList = showList; // sensorSPK = showList[0].spk; // foreach (var s in showList) // { // assembleValues += Convert.ToDouble(s.GetAttrState("value").Replace(",", ".")); // } // this.X = Application.GetRealWidth(7); // this.Width = Application.GetRealWidth(182); // this.Height = Application.GetRealWidth(124); // this.Y = Application.GetRealWidth(124 * (index / 2)); // this.Tag = sensorSPK; // if (index % 2 != 0) // { // this.X = Application.GetRealWidth(189); // } // switch (sensorSPK) // { // 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; // case SPK.SensorHcho: // imagePath = "FunctionIcon/EnvirSensor/HchoBg.png"; // iconPath = "FunctionIcon/EnvirSensor/HchoIcon.png"; // break; // } // } // public void LoadView() // { // Function sensor = sensorList[0]; // this.BackgroundImagePath = imagePath; // var btnIcon = new Button() // { // X = Application.GetRealWidth(23), // Y = Application.GetRealHeight(17), // Width = Application.GetRealWidth(32), // Height = Application.GetRealWidth(32), // UnSelectedImagePath = iconPath // }; // this.AddChidren(btnIcon); // btnIcon.MouseUpEventHandler = (sender, e) => // { // #region // var esp = new EnvironmentalSensorPage(sensor,sensorList); // 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", // }; // this.AddChidren(btnInfoIcon); // btnInfoIcon.MouseUpEventHandler = (sender, e) => // { // LoadInfo(sensorSPK); // }; // var curLevel = sensorTemp.GetCurLevel(sensorSPK, assembleValues); // var levelTextList = sensorTemp.GetLevelTextList(sensor); // btnLevel = new Button() // { // X = Application.GetRealWidth(25), // Y = Application.GetRealWidth(59), // Width = Application.GetRealWidth(100), // Height = Application.GetRealWidth(32), // TextAlignment = TextAlignment.CenterLeft, // TextColor = sensorTemp.GetLevelColorList(sensor)[curLevel - 1], // TextSize = CSS_FontSize.SubheadingFontSize, // Text = levelTextList[curLevel - 1], // Tag = "SensorLevel", // }; // this.AddChidren(btnLevel); // btnLevel.MouseUpEventHandler = (sender, e) => // { // #region // var esp = new EnvironmentalSensorPage(sensor,sensorList); // MainPage.BasePageView.AddChidren(esp); // esp.LoadPage(); // MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; // #endregion // }; // 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 = assembleValues.ToString(), // Tag = "SensorValues" // }; // this.AddChidren(btnSensorValues); // btnSensorValues.MouseUpEventHandler = (sender, e) => // { // #region // var esp = new EnvironmentalSensorPage(sensor,sensorList); // MainPage.BasePageView.AddChidren(esp); // esp.LoadPage(); // MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; // #endregion // }; // } // /// // /// 加载传感器等级相关信息 // /// // void LoadInfo(string sensorSPK) // { // var levelColorList = sensorTemp.GetLevelColorList(sensorSPK); // var levelTextList = sensorTemp.GetLevelTextList(sensorSPK); // 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 (sensorSPK) // { // 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(PPB)"; // break; // case SPK.SensorCO2: // btnTitle.Text = "CO2(PPM)"; // break; // case SPK.SensorHumidity: // btnTitle.Text = Language.StringByID(StringId.Humidity) + "(%)"; // break; // case SPK.SensorHcho: // btnTitle.Text = Language.StringByID(StringId.Formaldehyde) + "(mg/m3)"; // 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(sensorSPK)[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(); // } // public void calculateAverage() // { // assembleValues = 0; // foreach (var s in sensorList) // { // assembleValues += Convert.ToDouble(s.GetAttrState("value").Replace(",", ".")); // } // } // /// // /// 更新状态 // /// // /// // public void UpdataStatus(string spk ,string sid,string value) // { // try // { // if (spk == sensorSPK) // { // var temp = sensorList.Find((obj) => obj.sid == sid); // if(temp!= null) // { // temp.SetAttrState("value", value); // } // calculateAverage(); // btnSensorValues.Text = assembleValues.ToString(); // var curLevel = sensorTemp.GetCurLevel(sensorSPK, assembleValues); // btnLevel.TextID = sensorTemp.GetLevelTextList(sensorSPK)[curLevel- 1]; // btnLevel.TextColor = sensorTemp.GetLevelColorList(sensorSPK)[curLevel - 1]; // } // } // catch (Exception ex) // { // MainPage.Log($"更新环境传感器界面异常:{ex.Message}"); // } // } // } //}