From 05ce435c3b58e53eeab04c672affdeeab75f3036 Mon Sep 17 00:00:00 2001 From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local> Date: 星期五, 15 十一月 2019 14:41:39 +0800 Subject: [PATCH] 2019.11.15-1 --- ZigbeeApp/Shared/Common/DeviceUI.cs | 148 +++++++++++++++++++++++++------------------------ 1 files changed, 75 insertions(+), 73 deletions(-) diff --git a/ZigbeeApp/Shared/Common/DeviceUI.cs b/ZigbeeApp/Shared/Common/DeviceUI.cs index 1875ac6..5b31c90 100644 --- a/ZigbeeApp/Shared/Common/DeviceUI.cs +++ b/ZigbeeApp/Shared/Common/DeviceUI.cs @@ -35,9 +35,9 @@ var myDevice = Common.LocalDevice.Current.GetDevice(DeviceAddr, DeviceEpoint); if (myDevice != null) { - return $"DeviceUI_{myDevice.FilePath}"; + return myDevice.FilePath; } - return $"DeviceUI_Unkwon"; + return $"Device_Unkwon"; } } @@ -304,6 +304,11 @@ //涓户鍣� deviceTypeR = R.MyInternationalizationString.Repeater; break; + case DeviceType.DoorLock: + //闂ㄩ攣 + deviceTypeR = R.MyInternationalizationString.DoorLock; + break; + default: deviceTypeR = R.MyInternationalizationString.UnknowDevice; break; @@ -342,99 +347,96 @@ /// <returns></returns> public string GetDeviceStatu() { - if (CommonDevice.Type == DeviceType.OnOffOutput) + var device = CommonDevice; + if (device.Type == DeviceType.OnOffOutput) { - if ((CommonDevice as ToggleLight).OnOffStatus == 1) + if ((device as ToggleLight).OnOffStatus == 1) { return Language.StringByID(R.MyInternationalizationString.Open); } return Language.StringByID(R.MyInternationalizationString.Shut); } - else if (CommonDevice.Type == DeviceType.AirSwitch) + else if (device.Type == DeviceType.AirSwitch) { - if ((CommonDevice as ZigBee.Device.AirSwitch).OnOffStatus == 1) + if ((device as ZigBee.Device.AirSwitch).OnOffStatus == 1) { return Language.StringByID(R.MyInternationalizationString.Open); } return Language.StringByID(R.MyInternationalizationString.Shut); } - else if (CommonDevice.Type == DeviceType.DimmableLight) + else if (device.Type == DeviceType.DimmableLight) { - if ((CommonDevice as DimmableLight).OnOffStatus == 0 || (CommonDevice as DimmableLight).Level == 0) + if ((device as DimmableLight).OnOffStatus == 0 || (device as DimmableLight).Level == 0) { return Language.StringByID(R.MyInternationalizationString.Shut); } - return $"{(int)((CommonDevice as DimmableLight).Level * 1.0 / 254 * 100)}%"; + return $"{(int)((device as DimmableLight).Level * 1.0 / 254 * 100)}%"; } - else if (CommonDevice.Type == DeviceType.WindowCoveringDevice) + else if (device.Type == DeviceType.WindowCoveringDevice) { - if ((CommonDevice as ZigBee.Device.Rollershade).WcdCurrentPositionLiftPercentage == 0) + if ((device as Rollershade).WcdCurrentPositionLiftPercentage == 0) { return Language.StringByID(R.MyInternationalizationString.Shut); } - return $"{(CommonDevice as ZigBee.Device.Rollershade).WcdCurrentPositionLiftPercentage}%"; + return $"{(device as Rollershade).WcdCurrentPositionLiftPercentage}%"; } - //else if (CommonDevice.Type == DeviceType.Thermostat) - //{ - ////娓╁害锛屾ā寮忥紝椋庨�� - //string tempareture = string.Empty; - //string model = string.Empty; - //string wind = string.Empty; - //if (TaskList.Count == 0) - //{ - // return null; - //} - //foreach (var taskListInfo in TaskList) - //{ - // if (taskListInfo.Data1 == 3) - // { - // if (taskListInfo.Data2 == 0) - // { - // return Language.StringByID(R.MyInternationalizationString.Shut); - // } - // else if (taskListInfo.Data2 == 1) - // { - // model = Language.StringByID(R.MyInternationalizationString.Mode_Auto); - // } - // else if (taskListInfo.Data2 == 3) - // { - // model = Language.StringByID(R.MyInternationalizationString.Mode_Cool); - // } - // else if (taskListInfo.Data2 == 4) - // { - // model = Language.StringByID(R.MyInternationalizationString.Mode_Heat); - // } - // else if (taskListInfo.Data2 == 7) - // { - // model = Language.StringByID(R.MyInternationalizationString.Mode_FanOnly); - // } - // else if (taskListInfo.Data2 == 8) - // { - // model = Language.StringByID(R.MyInternationalizationString.Mode_Dry); - // } - // } - // else if (taskListInfo.Data1 == 4 || taskListInfo.Data1 == 5) - // { - // tempareture = $"{ taskListInfo.Data2} 鈩�"; - // } - // else if (taskListInfo.Data1 == 6) - // { - // if (taskListInfo.Data2 == 1) - // { - // wind = Language.StringByID(R.MyInternationalizationString.Fan_Low); - // } - // else if (taskListInfo.Data2 == 2) - // { - // wind = Language.StringByID(R.MyInternationalizationString.Fan_Middle); - // } - // else if (taskListInfo.Data2 == 3) - // { - // wind = Language.StringByID(R.MyInternationalizationString.Fan_Height); - // } - // } - //} - //return $"{tempareture},{model},{wind}"; - //} + else if (device.Type == DeviceType.Thermostat) + { + //娓╁害锛屾ā寮忥紝椋庨�� + string tempareture = string.Empty; + string model = string.Empty; + string wind = string.Empty; + + var ac = CommonDevice as AC; + + if (ac.currentSystemMode == 0) + { + return Language.StringByID(R.MyInternationalizationString.Shut); + } + else if (ac.currentSystemMode == 1) + { + model = Language.StringByID(R.MyInternationalizationString.Mode_Auto); + tempareture = $"{ac.currentCoolingSetpoint} 鈩�"; + } + else if (ac.currentSystemMode == 3) + { + model = Language.StringByID(R.MyInternationalizationString.Mode_Cool); + tempareture = $"{ac.currentCoolingSetpoint} 鈩�"; + } + else if (ac.currentSystemMode == 4) + { + model = Language.StringByID(R.MyInternationalizationString.Mode_Heat); + tempareture = $"{ac.currentHeatingSetpoint} 鈩�"; + } + else if (ac.currentSystemMode == 7) + { + model = Language.StringByID(R.MyInternationalizationString.Mode_FanOnly); + } + else if (ac.currentSystemMode == 8) + { + model = Language.StringByID(R.MyInternationalizationString.Mode_Dry); + tempareture = $"{ac.currentCoolingSetpoint} 鈩�"; + } + + if (ac.currentFanMode == 1) + { + wind = Language.StringByID(R.MyInternationalizationString.Fan_Low); + } + else if (ac.currentFanMode == 2) + { + wind = Language.StringByID(R.MyInternationalizationString.Fan_Middle); + } + else + { + wind = Language.StringByID(R.MyInternationalizationString.Fan_Height); + } + + if (string.IsNullOrEmpty(tempareture)) + { + return $"{model},{wind}"; + } + return $"{model},{wind},{tempareture}"; + } else { return null; -- Gitblit v1.8.0