| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using Shared; |
| | | |
| | | namespace HDL_ON.UI.UI2.Intelligence.Automation |
| | | { |
| | |
| | | //添加键值 |
| | | dic.Add(key, value); |
| | | } |
| | | |
| | | |
| | | public static void InputCondition() { |
| | | /// <summary> |
| | | /// 获取房间列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static List<HDL_ON.Entity.Room> GetRoomList() |
| | | { |
| | | return HDL_ON.Entity.DB_ResidenceData.rooms; |
| | | } |
| | | /// <summary> |
| | | /// 获取设备列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static List<HDL_ON.Entity.Function> GetDeviceList() |
| | | { |
| | | |
| | | return HDL_ON.Entity.DB_ResidenceData.functionList.GetAllFunction(); |
| | | } |
| | | /// <summary> |
| | | /// 获取房间的设备列表 |
| | | /// </summary> |
| | | /// <param name="room">当前房间</param> |
| | | /// <returns></returns> |
| | | public static List<HDL_ON.Entity.Function> GetRoomDevice(HDL_ON.Entity.Room room) |
| | | { |
| | | List<HDL_ON.Entity.Function> deviceLists = new List<Entity.Function>(); |
| | | List<HDL_ON.Entity.Function> lists = GetDeviceList(); |
| | | foreach (var dev in lists) |
| | | { |
| | | if (dev.roomIdList.Find((id) => id == room.sid) != null) |
| | | { |
| | | deviceLists.Add(dev); |
| | | } |
| | | } |
| | | return deviceLists; |
| | | } |
| | | /// <summary> |
| | | /// 获取设备 |
| | | /// </summary> |
| | | /// <param name="sid">设备唯一标识</param> |
| | | /// <returns></returns> |
| | | public static HDL_ON.Entity.Function GetDevice(string sid) |
| | | { |
| | | HDL_ON.Entity.Function device = new Entity.Function(); |
| | | List<HDL_ON.Entity.Function> deviceLists = GetDeviceList(); |
| | | foreach (var dev in deviceLists) |
| | | { |
| | | if (dev.sid == sid) |
| | | { |
| | | device = dev; |
| | | break; |
| | | } |
| | | } |
| | | return device; |
| | | } |
| | | /// <summary> |
| | | /// 获取房间名(即是=区域名称) |
| | | /// </summary> |
| | | /// <param name="device">设备</param> |
| | | /// <returns></returns> |
| | | public static string GetGetRoomName(HDL_ON.Entity.Function device) |
| | | { |
| | | string roomName = ""; |
| | | List<HDL_ON.Entity.Room> roomLists = GetRoomList(); |
| | | |
| | | foreach (var dev in device.roomIdList) |
| | | { |
| | | var room = roomLists.Find((c) => c.sid == dev); |
| | | if (room != null) |
| | | { |
| | | roomName += room.floorName + "." + room.name + ","; |
| | | } |
| | | } |
| | | |
| | | return roomName.TrimEnd(','); |
| | | } |
| | | /// <summary> |
| | | /// 获取房间名列表(即是=区域名称) |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static List<string> GetGetRoomNameList() |
| | | { |
| | | List<string> roomNameList = new List<string>(); |
| | | roomNameList.Add(Language.StringByID(StringId.allAreas)); |
| | | List<HDL_ON.Entity.Room> roomLists = GetRoomList(); |
| | | foreach (var room in roomLists) |
| | | { |
| | | roomNameList.Add(room.name); |
| | | } |
| | | |
| | | return roomNameList; |
| | | } |
| | | /// <summary> |
| | | /// 获取图标 |
| | | /// </summary> |
| | | /// <param name="functionType">设备类型</param> |
| | | /// <returns></returns> |
| | | public static string GetIconPath(FunctionType functionType) { |
| | | string strPath = ""; |
| | | switch (functionType) { |
| | | case FunctionType.Relay: { |
| | | strPath = "LogicIcon/lightloguc.png"; |
| | | } |
| | | break; |
| | | |
| | | } |
| | | return strPath; |
| | | } |
| | | } |
| | | } |