| | |
| | | /// </summary> |
| | | FrameLayout sensorListView; |
| | | |
| | | VerticalScrolViewLayout sensorListContentView; |
| | | |
| | | /// <summary> |
| | | /// 天气名称文本 |
| | | /// </summary> |
| | |
| | | TextColor = CSS_Color.TextualColor, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | Text = "--°C", |
| | | Text = $"{MainPage.cityInfo.highestTemperature}°C", |
| | | }; |
| | | topWeatherView.AddChidren(btnTempUpperLimitText); |
| | | |
| | |
| | | TextColor = CSS_Color.TextualColor, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | Text = "--°C", |
| | | Text = $"{MainPage.cityInfo.lowestTemperature}°C", |
| | | }; |
| | | topWeatherView.AddChidren(btnTempLowerLimitText); |
| | | |
| | |
| | | contentView.AddChidren(btnRoomClickRow); |
| | | |
| | | #endregion |
| | | |
| | | sensorListView = new FrameLayout() |
| | | sensorListContentView = new VerticalScrolViewLayout() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = Application.GetRealHeight(50), |
| | | Height = Application.GetRealHeight(456), |
| | | Height = Application.GetRealHeight(400), |
| | | Radius = (uint)Application.GetRealWidth(12), |
| | | BorderColor = 0x00000000, |
| | | BorderWidth = 0, |
| | | }; |
| | | contentView.AddChidren(sensorListView); |
| | | contentView.AddChidren(sensorListContentView); |
| | | sensorListView = new FrameLayout(); |
| | | sensorListContentView.AddChidren(sensorListView); |
| | | |
| | | LoadSenesorList(); |
| | | |
| | |
| | | int index = 0; |
| | | foreach (var sensor in FunctionList.List.GetEnvirSensorsList()) |
| | | { |
| | | LoadSensorDiv(sensor, index); |
| | | index++; |
| | | if(SPK.EvironmentSensorList().Contains(sensor.spk)) |
| | | { |
| | | foreach (var seTemp in sensor.attributes) |
| | | { |
| | | var newTemp = new Function() |
| | | { |
| | | name = sensor.name, |
| | | sid = sensor.sid, |
| | | deviceId = sensor.deviceId, |
| | | roomIds = sensor.roomIds, |
| | | attributes = new List<FunctionAttributes> { new FunctionAttributes { key = "value", state = seTemp.state, curValue = seTemp.curValue } |
| | | ,new FunctionAttributes { key = "spk"} } |
| | | }; |
| | | switch (seTemp.key) |
| | | { |
| | | case "co2": |
| | | newTemp.spk = SPK.SensorCO2; |
| | | newTemp.SetAttrState("spk", "co2"); |
| | | break; |
| | | case "pm25": |
| | | newTemp.spk = SPK.SensorPm25; |
| | | newTemp.SetAttrState("spk", "pm25"); |
| | | break; |
| | | case "humidity": |
| | | newTemp.spk = SPK.SensorHumidity; |
| | | newTemp.SetAttrState("spk", "humidity"); |
| | | break; |
| | | case "temperature": |
| | | newTemp.spk = SPK.SensorTemperature; |
| | | newTemp.SetAttrState("spk", "temperature"); |
| | | break; |
| | | case "tvoc": |
| | | newTemp.spk = SPK.SensorTVOC; |
| | | newTemp.SetAttrState("spk", "tvoc"); |
| | | break; |
| | | default: |
| | | continue; |
| | | break; |
| | | } |
| | | |
| | | if (room.roomId == "" || sensor.roomIds.Contains(room.roomId)) |
| | | { |
| | | LoadSensorDiv(newTemp, index); |
| | | index++; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (room.roomId == "" || sensor.roomIds.Contains(room.roomId)) |
| | | { |
| | | LoadSensorDiv(sensor, index); |
| | | index++; |
| | | } |
| | | } |
| | | |
| | | new System.Threading.Thread(() => |
| | | { |
| | | Control.Ins.SendReadCommand(sensor); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | sensorListView.Height = Application.GetRealWidth(124 * (index + 1) / 2); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 加载传感器列表 |
| | | /// </summary> |
| | | void LoadSensorDiv(Function sensor, int 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; |
| | | var sensorTag = sensor.spk + sensor.sid + sensor.deviceId; |
| | | FrameLayout sensorView = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(7), |
| | |
| | | #endregion |
| | | }; |
| | | |
| | | |
| | | new System.Threading.Thread(() => |
| | | { |
| | | Control.Ins.SendReadCommand(sensor); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | if (bodyView != null) |
| | | { |
| | | if (SPK.EvironmentSensorList().Contains(updateTemp.spk )) |
| | | { |
| | | foreach (var seTemp in updateTemp.attributes) |
| | | { |
| | | var newTemp = new Function() |
| | | { |
| | | name = updateTemp.name, |
| | | sid = updateTemp.sid, |
| | | deviceId = updateTemp.deviceId, |
| | | attributes = new List<FunctionAttributes> { new FunctionAttributes { key = "value", state = seTemp.state ,curValue = seTemp.curValue} }, |
| | | }; |
| | | switch (seTemp.key) |
| | | { |
| | | case "co2": |
| | | newTemp.spk = SPK.SensorCO2; |
| | | break; |
| | | case "pm25": |
| | | newTemp.spk = SPK.SensorPm25; |
| | | break; |
| | | case "humidity": |
| | | newTemp.spk = SPK.SensorHumidity; |
| | | break; |
| | | case "temperature": |
| | | newTemp.spk = SPK.SensorTemperature; |
| | | break; |
| | | case "tvoc": |
| | | newTemp.spk = SPK.SensorTVOC; |
| | | break; |
| | | } |
| | | if(!string.IsNullOrEmpty(newTemp.spk)) |
| | | { |
| | | LoadEvent_UpdataStatus(newTemp); |
| | | } |
| | | } |
| | | } |
| | | |
| | | for (int i = 0; i < bodyView.sensorListView.ChildrenCount; i++) |
| | | { |
| | | var sensorTag = updateTemp.sid; |
| | | var sensorTag = updateTemp.spk + updateTemp.sid + updateTemp.deviceId; |
| | | var view = bodyView.sensorListView.GetChildren(i); |
| | | if (view.GetType() == typeof(FrameLayout)) |
| | | { |