| | |
| | | /// </summary> |
| | | FrameLayout sensorListView; |
| | | |
| | | VerticalScrolViewLayout sensorListContentView; |
| | | |
| | | /// <summary> |
| | | /// 天气名称文本 |
| | | /// </summary> |
| | |
| | | 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()) |
| | | { |
| | | if(sensor.spk == SPK.SensorEnvironment) |
| | | if(SPK.EvironmentSensorList().Contains(sensor.spk)) |
| | | { |
| | | foreach (var seTemp in sensor.attributes) |
| | | { |
| | |
| | | name = sensor.name, |
| | | sid = sensor.sid, |
| | | deviceId = sensor.deviceId, |
| | | attributes = new List<FunctionAttributes> { new FunctionAttributes { key = "value", state = seTemp.state, curValue = seTemp.curValue } }, |
| | | roomIds = sensor.roomIds, |
| | | attributes = new List<FunctionAttributes> { new FunctionAttributes { key = "value", state = seTemp.state, curValue = seTemp.curValue } |
| | | , new FunctionAttributes {key = "spk",state = seTemp.key,curValue = seTemp.key } |
| | | //,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; |
| | | } |
| | | LoadSensorDiv(newTemp, index); |
| | | index++; |
| | | |
| | | if (room.roomId == "" || sensor.roomIds.Contains(room.roomId)) |
| | | { |
| | | LoadSensorDiv(newTemp, index); |
| | | index++; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | #if DEBUG |
| | | continue; |
| | | #endif |
| | | LoadSensorDiv(sensor, index); |
| | | index++; |
| | | if (room.roomId == "" || sensor.roomIds.Contains(room.roomId)) |
| | | { |
| | | LoadSensorDiv(sensor, index); |
| | | index++; |
| | | } |
| | | } |
| | | |
| | | new System.Threading.Thread(() => |
| | |
| | | }) |
| | | { 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.spk + sensor.sid + sensor.deviceId; |
| | | FrameLayout sensorView = new FrameLayout() |
| | |
| | | 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; |
| | | } |
| | | sensorView.BackgroundImagePath = imagePath; |
| | |
| | | Width = Application.GetRealWidth(100), |
| | | Height = Application.GetRealWidth(32), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextColor = sensorTemp.GetLevelColorList(sensor.spk)[sensorTemp.GetCurLevel(sensor) - 1], |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextID = levelTextList[sensorTemp.GetCurLevel(sensor) - 1], |
| | | Tag = "SensorLevel", |
| | | }; |
| | | sensorView.AddChidren(btnLevel); |
| | | |
| | | btnLevel.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | #region |
| | |
| | | btnTitle.Text = Language.StringByID(StringId.Temp) + "(°C)"; |
| | | break; |
| | | case SPK.SensorTVOC: |
| | | btnTitle.Text = "TVOC(PPM)"; |
| | | 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; |
| | | } |
| | | |
| | |
| | | { |
| | | if (bodyView != null) |
| | | { |
| | | if (updateTemp.spk == SPK.SensorEnvironment) |
| | | if (SPK.EvironmentSensorList().Contains(updateTemp.spk )) |
| | | { |
| | | foreach (var seTemp in updateTemp.attributes) |
| | | { |
| | |
| | | case "tvoc": |
| | | newTemp.spk = SPK.SensorTVOC; |
| | | break; |
| | | case "hcho": |
| | | newTemp.spk = SPK.SensorHcho; |
| | | break; |
| | | } |
| | | if(!string.IsNullOrEmpty(newTemp.spk)) |
| | | { |
| | |
| | | { |
| | | if (btn.Tag != null) |
| | | { |
| | | FunctionAttributes attr = updateTemp.GetAttribute(FunctionAttributeKey.Value); |
| | | if(attr == null) |
| | | { |
| | | switch(updateTemp.spk) |
| | | { |
| | | case SPK.SensorCO2: |
| | | attr = updateTemp.GetAttribute(FunctionAttributeKey.Co2); |
| | | break; |
| | | case SPK.SensorTemperature: |
| | | attr = updateTemp.GetAttribute(FunctionAttributeKey.Temperature); |
| | | break; |
| | | case SPK.SensorTVOC: |
| | | attr = updateTemp.GetAttribute(FunctionAttributeKey.Tvoc); |
| | | break; |
| | | case SPK.SensorPm25: |
| | | attr = updateTemp.GetAttribute(FunctionAttributeKey.Pm25); |
| | | break; |
| | | case SPK.SensorHcho: |
| | | attr = updateTemp.GetAttribute(FunctionAttributeKey.Hcho); |
| | | break; |
| | | case SPK.SensorHumidity: |
| | | attr = updateTemp.GetAttribute(FunctionAttributeKey.Humidity); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | var tag = btn.Tag.ToString(); |
| | | if (tag == "SensorValues") |
| | | { |
| | | (btn as Button).Text = updateTemp.GetAttrState(FunctionAttributeKey.Value); |
| | | (btn as Button).Text = attr.state;// updateTemp.GetAttrState(FunctionAttributeKey.Value); |
| | | } |
| | | else if (tag == "SensorLevel") |
| | | { |