| | |
| | | { |
| | | X = Application.GetRealWidth(29), |
| | | Y = Application.GetRealHeight(374), |
| | | Width = Application.GetRealWidth(340), |
| | | Width = Application.GetRealWidth(400), |
| | | Height = Application.GetRealHeight(80), |
| | | BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor2 |
| | | }; |
| | |
| | | var temperatureText = new Button |
| | | { |
| | | X = Application.GetRealWidth(69), |
| | | Width = Application.GetRealWidth(100), |
| | | Width = Application.GetRealWidth(120), |
| | | Height = Application.GetRealHeight(58), |
| | | Gravity = Gravity.CenterVertical, |
| | | Text = "26℃" |
| | | Text = $"{room.Temperatrue}℃" |
| | | }; |
| | | roomTemperatureBackground.AddChidren(temperatureText); |
| | | |
| | | var humidityIcon = new Button |
| | | { |
| | | X = Application.GetRealWidth(179), |
| | | X = Application.GetRealWidth(200), |
| | | Width = Application.GetMinRealAverage(58), |
| | | Height = Application.GetMinRealAverage(58), |
| | | Gravity = Gravity.CenterVertical, |
| | |
| | | |
| | | var humidityText = new Button |
| | | { |
| | | X = Application.GetRealWidth(236), |
| | | Width = Application.GetRealWidth(86), |
| | | X = Application.GetRealWidth(260), |
| | | Width = Application.GetRealWidth(120), |
| | | Height = Application.GetRealHeight(58), |
| | | Gravity = Gravity.CenterVertical, |
| | | Text = "13%" |
| | | Text = $"{room.Humidity}%" |
| | | }; |
| | | roomTemperatureBackground.AddChidren(humidityText); |
| | | |
| | |
| | | { |
| | | //0℃ |
| | | temperatureText.Text = "0.0℃"; |
| | | room.Temperatrue = 0; |
| | | } |
| | | else if (data.AttriButeData > 32767) |
| | | { |
| | |
| | | //小数点需要一位 |
| | | strValue = strValue.Substring(0, strValue.Length - 1); |
| | | temperatureText.Text = strValue.Insert(strValue.Length - 1, ".") + "℃"; |
| | | room.Temperatrue = int.Parse(strValue) * 0.1; |
| | | } |
| | | else |
| | | { |
| | |
| | | string strValue = data.AttriButeData.ToString(); |
| | | strValue = strValue.Substring(0, strValue.Length - 1); |
| | | temperatureText.Text = strValue.Insert(strValue.Length - 1, ".") + "℃"; |
| | | room.Temperatrue = int.Parse(strValue) * 0.1; |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | //0 |
| | | humidityText.Text = "0.0%"; |
| | | room.Humidity = 0; |
| | | } |
| | | else |
| | | { |
| | |
| | | string strValue = data.AttriButeData.ToString(); |
| | | strValue = strValue.Substring(0, strValue.Length - 1); |
| | | humidityText.Text = strValue.Insert(strValue.Length - 1, ".") + "%"; |
| | | room.Humidity = int.Parse(strValue) * 0.1; |
| | | } |
| | | } |
| | | } |
| | |
| | | (dev as ZigBee.Device.TemperatureSensor).ReadTemperatureOrHumidity(); |
| | | } |
| | | } |
| | | |
| | | |
| | | var roomListBtn = new Button() |
| | | { |
| | |
| | | action?.Invoke(); |
| | | }; |
| | | }; |
| | | |
| | | } |
| | | } |
| | | } |