| | |
| | | { |
| | | if (view.Tag.ToString() == flag) |
| | | { |
| | | view.UpdataStatus(flag,updateTemp.sid, sensorAttr.state); |
| | | view.UpdataStatus(flag,updateTemp, sensorAttr.state); |
| | | } |
| | | } |
| | | |
| | |
| | | List<Function> sensorList = new List<Function>(); |
| | | string imagePath = ""; |
| | | string iconPath = ""; |
| | | string sensorSPK = ""; |
| | | Sensor sensorTemp = new Sensor(); |
| | | double assembleValues = 0.0; |
| | | |
| | | public SensorView(List<Function> 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.Width = Application.GetRealWidth(182); |
| | | this.Height = Application.GetRealWidth(124); |
| | | this.Y = Application.GetRealWidth(124 * (index / 2)); |
| | | this.Tag = sensorSPK; |
| | | this.Tag = showList[0].spk; |
| | | |
| | | if (index % 2 != 0) |
| | | { |
| | |
| | | } |
| | | |
| | | |
| | | switch (sensorSPK) |
| | | switch (showList[0].spk) |
| | | { |
| | | case SPK.SensorCO2: |
| | | imagePath = "FunctionIcon/EnvirSensor/Co2Bg.png"; |
| | |
| | | this.AddChidren(btnInfoIcon); |
| | | btnInfoIcon.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | LoadInfo(sensorSPK); |
| | | LoadInfo(sensor); |
| | | }; |
| | | |
| | | var curLevel = sensorTemp.GetCurLevel(sensorSPK, assembleValues); |
| | | var levelTextList = sensorTemp.GetLevelTextList(sensorSPK); |
| | | var curLevel = sensorTemp.GetCurLevel(sensor); |
| | | var levelTextList = sensorTemp.GetLevelTextList(sensor); |
| | | btnLevel = new Button() |
| | | { |
| | | X = Application.GetRealWidth(25), |
| | |
| | | Width = Application.GetRealWidth(100), |
| | | Height = Application.GetRealWidth(32), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = sensorTemp.GetLevelColorList(sensorSPK)[curLevel - 1], |
| | | TextColor = sensorTemp.GetLevelColorList(sensor)[curLevel - 1], |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextID = levelTextList[curLevel - 1], |
| | | Text = levelTextList[curLevel - 1], |
| | | Tag = "SensorLevel", |
| | | }; |
| | | this.AddChidren(btnLevel); |
| | |
| | | /// <summary> |
| | | /// 加载传感器等级相关信息 |
| | | /// </summary> |
| | | void LoadInfo(string sensorSPK) |
| | | void LoadInfo(Function sensor) |
| | | { |
| | | var levelColorList = sensorTemp.GetLevelColorList(sensorSPK); |
| | | var levelTextList = sensorTemp.GetLevelTextList(sensorSPK); |
| | | var levelColorList = sensorTemp.GetLevelColorList(sensor); |
| | | var levelTextList = sensorTemp.GetLevelTextList(sensor); |
| | | Dialog dialog = new Dialog(); |
| | | |
| | | FrameLayout dialogBodyView = new FrameLayout(); |
| | |
| | | }; |
| | | infoView.AddChidren(btnTitle); |
| | | |
| | | switch (sensorSPK) |
| | | switch (sensor.spk) |
| | | { |
| | | case SPK.SensorPm25: |
| | | btnTitle.Text = "PM2.5(ug/m³)"; |
| | |
| | | btnTitle.Text = Language.StringByID(StringId.Temp) + "(°C)"; |
| | | break; |
| | | case SPK.SensorTVOC: |
| | | btnTitle.Text = "TVOC(PPB)"; |
| | | btnTitle.Text = "TVOC(mg/m³)"; |
| | | break; |
| | | case SPK.SensorCO2: |
| | | btnTitle.Text = "CO2(PPM)"; |
| | |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | IsBold = true, |
| | | Text = sensorTemp.GetIntervalValue(sensorSPK)[index] |
| | | Text = sensorTemp.GetIntervalValue(sensor)[index] |
| | | }); |
| | | |
| | | subInfoView.AddChidren(new Button() |
| | |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | IsBold = true, |
| | | TextID = levelTextList[index] |
| | | Text = levelTextList[index] |
| | | }); |
| | | |
| | | subInfoView.AddChidren(new Button() |
| | |
| | | /// 更新状态 |
| | | /// </summary> |
| | | /// <param name="updateTemp"></param> |
| | | public void UpdataStatus(string spk ,string sid,string value) |
| | | public void UpdataStatus(string spk ,Function function,string value) |
| | | { |
| | | try |
| | | { |
| | | if (spk == sensorSPK) |
| | | if (spk == function.spk) |
| | | { |
| | | var temp = sensorList.Find((obj) => obj.sid == sid); |
| | | var temp = sensorList.Find((obj) => obj.sid == function.sid); |
| | | if(temp!= null) |
| | | { |
| | | temp.SetAttrState("value", value); |
| | |
| | | |
| | | btnSensorValues.Text = assembleValues.ToString(); |
| | | |
| | | var curLevel = sensorTemp.GetCurLevel(sensorSPK, assembleValues); |
| | | var curLevel = sensorTemp.GetCurLevel(function); |
| | | |
| | | btnLevel.TextID = sensorTemp.GetLevelTextList(sensorSPK)[curLevel- 1]; |
| | | btnLevel.TextColor = sensorTemp.GetLevelColorList(sensorSPK)[curLevel - 1]; |
| | | btnLevel.Text = sensorTemp.GetLevelTextList(temp)[curLevel- 1]; |
| | | btnLevel.TextColor = sensorTemp.GetLevelColorList(function)[curLevel - 1]; |
| | | } |
| | | } |
| | | catch (Exception ex) |