From c7698e163e43cea9e7f8ee45f8e3f91c9265cca4 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期一, 04 十一月 2019 19:11:41 +0800 Subject: [PATCH] 合并了全部的代码 --- ZigbeeApp/Shared/Common/DeviceUI.cs | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 107 insertions(+), 2 deletions(-) diff --git a/ZigbeeApp/Shared/Common/DeviceUI.cs b/ZigbeeApp/Shared/Common/DeviceUI.cs index 7bad709..4e36b30 100755 --- a/ZigbeeApp/Shared/Common/DeviceUI.cs +++ b/ZigbeeApp/Shared/Common/DeviceUI.cs @@ -324,9 +324,9 @@ var room = Room.CurrentRoom.GetRoomByDevice(CommonDevice); if (room == null) { - return null; + return Language.StringByID(R.MyInternationalizationString.UnallocatedArea); } - var floorName = Shared.Common.Config.Instance.Home.GetFloorNameById(room.FloorId); + var floorName = Config.Instance.Home.GetFloorNameById(room.FloorId); if (floorName == null) { return room.Name; @@ -335,5 +335,110 @@ } #endregion + + /// <summary> + /// GetDeviceStatu + /// </summary> + /// <returns></returns> + public string GetDeviceStatu() + { + if (CommonDevice.Type == DeviceType.OnOffOutput) + { + if ((CommonDevice as ToggleLight).OnOffStatus == 1) + { + return Language.StringByID(R.MyInternationalizationString.Open); + } + return Language.StringByID(R.MyInternationalizationString.Shut); + } + else if (CommonDevice.Type == DeviceType.AirSwitch) + { + if ((CommonDevice as ZigBee.Device.AirSwitch).OnOffStatus == 1) + { + return Language.StringByID(R.MyInternationalizationString.Open); + } + return Language.StringByID(R.MyInternationalizationString.Shut); + } + else if (CommonDevice.Type == DeviceType.DimmableLight) + { + if ((CommonDevice as DimmableLight).OnOffStatus == 0 || (CommonDevice as DimmableLight).Level == 0) + { + return Language.StringByID(R.MyInternationalizationString.Shut); + } + return $"{(int)((CommonDevice as DimmableLight).Level * 1.0 / 254 * 100)}%"; + } + else if (CommonDevice.Type == DeviceType.WindowCoveringDevice) + { + if ((CommonDevice as ZigBee.Device.Rollershade).WcdCurrentPositionLiftPercentage == 0) + { + return Language.StringByID(R.MyInternationalizationString.Shut); + } + return $"{(CommonDevice as ZigBee.Device.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 + { + return null; + } + } } } -- Gitblit v1.8.0