| | |
| | | |
| | | public class LogicMethod |
| | | { |
| | | /// <summary> |
| | | /// 表示是条件 |
| | | /// </summary> |
| | | public const string condition_if = "条件"; |
| | | /// <summary> |
| | | /// 表示是目标 |
| | | /// </summary> |
| | | public const string target_if = "目标"; |
| | | /// <summary> |
| | | /// 移除所有"Logic"界面 |
| | | /// </summary> |
| | | public static void RemoveAllView() |
| | | { |
| | | MainPage.BasePageView.RemoveViewByTag("Logic"); |
| | | } |
| | | /// <summary> |
| | | /// 生成逻辑sid方法 |
| | | /// </summary> |
| | |
| | | /// 获取网关房间列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static List<HDL_ON.Entity.Room> GetGatewayRoomListG() |
| | | public static List<HDL_ON.Entity.Room> GetGatewayRoomList() |
| | | { |
| | | return HDL_ON.Entity.DB_ResidenceData.rooms; |
| | | } |
| | |
| | | /// 获取网关房间列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static List<HDL_ON.Entity.Room> GetGatewayRoomListG(string name) |
| | | public static List<HDL_ON.Entity.Room> GetGatewayRoomList(string name) |
| | | { |
| | | |
| | | List<Entity.Room> roomList = new List<Entity.Room>(); |
| | |
| | | room1.name = name;//默认一个房间名为:全部区域 |
| | | room1.sid = "全部区域";//默认sid用识别该房间 |
| | | roomList.Add(room1);//默认添加到房间列表里 |
| | | var roomLists = GetGatewayRoomListG(); |
| | | var roomLists = GetGatewayRoomList(); |
| | | foreach (var room in roomLists) |
| | | { |
| | | roomList.Add(room); |
| | |
| | | { |
| | | |
| | | return HDL_ON.Entity.DB_ResidenceData.functionList.GetAllFunction(); |
| | | } |
| | | /// <summary> |
| | | /// 获取网关场景列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static List<HDL_ON.Entity.Scene> GetSceneList() |
| | | { |
| | | return HDL_ON.Entity.DB_ResidenceData.functionList.scenes; |
| | | } |
| | | /// <summary> |
| | | /// 获取房间的设备列表 |
| | |
| | | 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(); |
| | | HDL_ON.Entity.Function device = new Entity.Function() { name= "Unknown",sid="设备不存在"}; |
| | | List<HDL_ON.Entity.Function> deviceLists = GetGatewayDeviceList(); |
| | | foreach (var dev in deviceLists) |
| | | { |
| | |
| | | } |
| | | return device; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取当个场景 |
| | | /// </summary> |
| | | /// <param name="sid">场景唯一标识</param> |
| | | /// <returns></returns> |
| | | public static HDL_ON.Entity.Scene GetSecne(string sid) |
| | | { |
| | | HDL_ON.Entity.Scene scene = new Entity.Scene() { name = "Unknown", sid = "场景不存在" }; |
| | | List<HDL_ON.Entity.Scene> sceneLists = GetSceneList(); |
| | | foreach (var sce in sceneLists) |
| | | { |
| | | if (sce.sid == sid) |
| | | { |
| | | scene = sce; |
| | | break; |
| | | } |
| | | } |
| | | return scene; |
| | | } |
| | | /// <summary> |
| | | /// 获取房间名(即是=区域名称) |
| | | /// </summary> |
| | |
| | | public static string GetGetRoomName(HDL_ON.Entity.Function device) |
| | | { |
| | | string roomName = ""; |
| | | List<HDL_ON.Entity.Room> roomLists = GetGatewayRoomListG(); |
| | | List<HDL_ON.Entity.Room> roomLists = GetGatewayRoomList(); |
| | | |
| | | foreach (var dev in device.roomIdList) |
| | | { |
| | |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 条件支持设备 |
| | | /// 条件/目标支持设备 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static List<FunctionType> GetConditionFunctionTypeDevice() |
| | | public static List<FunctionType> GetSupportEquipment(string if_type) |
| | | { |
| | | List<FunctionType> deviceTypeList = new List<FunctionType>(); |
| | | deviceTypeList.Add(FunctionType.Relay); |
| | | switch (if_type) { |
| | | case condition_if: { |
| | | deviceTypeList.Add(FunctionType.Relay); |
| | | } |
| | | break; |
| | | case target_if: |
| | | { |
| | | deviceTypeList.Add(FunctionType.Relay); |
| | | } |
| | | break; |
| | | } |
| | | return deviceTypeList; |
| | | } |
| | | /// <summary> |
| | | /// 目标支持设备 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static List<FunctionType> GetTargetFunctionTypeDevice() |
| | | { |
| | | List<FunctionType> deviceTypeList = new List<FunctionType>(); |
| | | return deviceTypeList; |
| | | } |
| | | /// <summary> |
| | | /// 显示的设备列表 |
| | | /// </summary> |
| | |
| | | } |
| | | return devList; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 返回最终支持显示出来的设备列表 |
| | | /// </summary> |
| | | /// <param name="room">当前房间</param> |
| | | /// <param name="str">判断符(表示=输入设备和输出设备)</param> |
| | | /// <returns></returns> |
| | | public static List<Entity.Function> GetFunctionDeviceList(Entity.Room room,string str) |
| | | public static List<Entity.Function> GetFunctionDeviceList(Entity.Room room, string str) |
| | | { |
| | | List<FunctionType> functionTypeList=new List<FunctionType>(); |
| | | switch (str) { |
| | | case condition_if: { |
| | | //返回条件支持设备列表 |
| | | functionTypeList = GetConditionFunctionTypeDevice(); |
| | | } |
| | | break; |
| | | case target_if: |
| | | { |
| | | //返回目标支持设备列表 |
| | | functionTypeList = GetTargetFunctionTypeDevice(); |
| | | } |
| | | break; |
| | | } |
| | | List<FunctionType> functionTypeList = GetSupportEquipment(str); |
| | | //返回房间设备列表 |
| | | var roomDeviceList = GetRoomDevice(room); |
| | | //返回最终支持显示出来的设备列表 |
| | | var list= GetShowDeviceList(functionTypeList, roomDeviceList); |
| | | var list = GetShowDeviceList(functionTypeList, roomDeviceList); |
| | | return list; |
| | | } |
| | | |
| | | |
| | | } |
| | | } |