//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 // { // #region 控件集合 // static EnvironmentalSciencePage bodyView; // /// // /// 楼层显示 // /// // Button btnRoom; // /// // /// 房间选择下拉图标 // /// // Button btnFoorDownIcon; // /// // /// 房间选择触发区域 // /// // Button btnRoomClickRow; // /// // /// 传感器列表区域 // /// // FrameLayout sensorListView; // /// // /// 天气名称文本 // /// // Button btnWatherText; // /// // /// 湿度数据文本 // /// // Button btnHumidityText; // /// // /// pm25数据文本 // /// // Button btnPm25Values; // /// // /// 风速数据文本 // /// // Button btnFanSpeedValues; // #endregion // #region 区域变量 // Room room; // Sensor sensorTemp = new Sensor(); // #endregion // public EnvironmentalSciencePage() // { // bodyView = this; // } // /// // /// 加载界面 // /// // /// 收藏按钮 // /// 功能名称信息按钮 // /// 功能楼层信息按钮 // 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); // 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 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); // 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 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 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); // 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); // 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); // 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 // #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); // 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), // Width = Application.GetRealWidth(308), // Height = Application.GetRealHeight(456), // Radius = (uint)Application.GetRealWidth(12), // BorderColor = 0x00000000, // BorderWidth = 0, // }; // contentView.AddChidren(sensorListView); // LoadSenesorList(); // LoadEventList(); // #endregion // //LoadEventList(); // LoadDialog_ChangeRoom(); // new TopViewDiv(bodyView, Language.StringByID(StringId.EnvironmentalScience)).LoadTopView(); // } // /// // /// 加载传感器列表 // /// // void LoadSenesorList() // { // sensorListView.RemoveAll(); // int index = 0; // foreach (var sensor in FunctionList.List.GetEnvirSensorsList()) // { // LoadSensorDiv(sensor, index); // index++; // } // } // /// // /// 加载传感器列表 // /// // 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); // 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 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 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); // } // } // /// // /// 加载传感器等级相关信息 // /// // 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(); // } // /// // /// 房间列表点击事件 // /// // 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.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(); // }; // } // dialog.Show(); // }; // btnRoomClickRow.MouseUpEventHandler = eventHandler; // //btnFoorDownIcon.MouseUpEventHandler = eventHandler; // } // } //}