| | |
| | | |
| | | if (set_temp != "") |
| | | { |
| | | string unit = device.GetAttribute("temperature_type") == null ? "℃" : device.GetAttribute("temperature_type").state; |
| | | if (string.IsNullOrEmpty(unit)) |
| | | { |
| | | unit = "℃"; |
| | | } |
| | | string unit =GetTemperatureUnit(device); |
| | | stateStr += set_temp + unit + ","; |
| | | } |
| | | |
| | |
| | | } |
| | | if (set_temp != "") |
| | | { |
| | | string unit = device.GetAttribute("temperature_type") == null ? "℃" : device.GetAttribute("temperature_type").state; |
| | | if (string.IsNullOrEmpty(unit)) |
| | | { |
| | | unit = "℃"; |
| | | } |
| | | string unit = GetTemperatureUnit(device); |
| | | stateStr += set_temp + unit + ","; |
| | | } |
| | | if (mode != "") |
| | |
| | | //怕调试软件乱上东西导致抛异常 |
| | | break; |
| | | } |
| | | button2.Text = value + "℃"; |
| | | button2.Text = value + GetTemperatureUnit(device); ; |
| | | } |
| | | break; |
| | | case "mode": |
| | |
| | | //怕调试软件乱上东西导致抛异常 |
| | | break; |
| | | } |
| | | button2.Text = value + "℃"; |
| | | button2.Text = value + GetTemperatureUnit(device); ; |
| | | } |
| | | break; |
| | | case "mode": |
| | |
| | | return dicList[0]["value"].ToString(); |
| | | } |
| | | /// <summary> |
| | | /// 获取温度单位 |
| | | /// </summary> |
| | | /// <param name="device"></param> |
| | | /// <returns></returns> |
| | | public string GetTemperatureUnit(Entity.Function device) |
| | | { |
| | | string unit = string.Empty; |
| | | if (device.GetAttribute("temperature_type") != null && device.GetAttribute("temperature_type").value.Count > 0) |
| | | { |
| | | unit = device.GetAttribute("temperature_type").value[0]; |
| | | } |
| | | if (string.IsNullOrEmpty(unit)) |
| | | { |
| | | //调试软件有空能上传为空 |
| | | unit = "℃"; |
| | | } |
| | | return unit; |
| | | } |
| | | /// <summary> |
| | | ///获取自动化名称 |
| | | /// </summary> |
| | | /// <returns> 新建自动化命名规则</returns> |