| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using HDL_ON.Entity; |
| | | using Shared; |
| | | |
| | | namespace HDL_ON.UI.UI2.Intelligence.Automation |
| | |
| | | /// </summary> |
| | | /// <param name="functionType">设备类型</param> |
| | | /// <returns></returns> |
| | | public static string GetIconPath(FunctionType functionType) |
| | | public static string GetIconPath(string functionType) |
| | | { |
| | | string strPath = ""; |
| | | switch (functionType) |
| | | { |
| | | case FunctionType.Relay: |
| | | case FunctionType.RGB: |
| | | case FunctionType.RGBW: |
| | | case FunctionType.ColorTemperature: |
| | | case FunctionType.Dimmer: |
| | | case SPK.LightSwitch: |
| | | case SPK.LightRGB: |
| | | case SPK.LightRGBW: |
| | | case SPK.LightCCT: |
| | | case SPK.LightDimming: |
| | | { |
| | | strPath = "LogicIcon/lightloguc.png"; |
| | | } |
| | | break; |
| | | case FunctionType.Curtain: |
| | | case FunctionType.RollingShutter: |
| | | case FunctionType.MotorCurtain: |
| | | case SPK.CurtainSwitch: |
| | | case SPK.CurtainRoller: |
| | | case SPK.CurtainTrietex: |
| | | { |
| | | strPath = "LogicIcon/curtainlogic.png"; |
| | | } |
| | | break; |
| | | case FunctionType.AC: |
| | | case SPK.AcStandard: |
| | | { |
| | | strPath = "LogicIcon/airconditionerlogic.png"; |
| | | } |
| | | break; |
| | | case FunctionType.FloorHeating: |
| | | case SPK.FloorHeatStandard: |
| | | { |
| | | strPath = "LogicIcon/heatlogic.png"; |
| | | } |
| | |
| | | { |
| | | List<string> deviceStrTypeList = new List<string>(); |
| | | deviceStrTypeList.Clear(); |
| | | var lightjosn = deviceList.Find((device) => device.functionType == FunctionType.Relay || device.functionType == FunctionType.Dimmer || device.functionType == FunctionType.ColorTemperature || device.functionType == FunctionType.RGB || device.functionType == FunctionType.RGBW); |
| | | var lightjosn = deviceList.Find((device) => device.spk == SPK.LightSwitch || device.spk == SPK.LightDimming || device.spk == SPK.LightCCT || device.spk == SPK.LightRGB || device.spk == SPK.LightRGBW); |
| | | if (lightjosn != null) |
| | | { |
| | | deviceStrTypeList.Add(Language.StringByID(StringId.Lights)); |
| | | } |
| | | |
| | | var curtainjosn = deviceList.Find((device) => device.functionType == FunctionType.Curtain || device.functionType == FunctionType.MotorCurtain || device.functionType == FunctionType.RollingShutter); |
| | | var curtainjosn = deviceList.Find((device) => device.spk == SPK.CurtainSwitch || device.spk == SPK.CurtainTrietex || device.spk == SPK.CurtainRoller); |
| | | if (curtainjosn != null) |
| | | { |
| | | deviceStrTypeList.Add(Language.StringByID(StringId.Curtain)); |
| | | } |
| | | |
| | | var ac = deviceList.Find((device) => device.functionType == FunctionType.AC); |
| | | var ac = deviceList.Find((device) => device.spk == SPK.AcStandard); |
| | | if (ac != null) |
| | | { |
| | | deviceStrTypeList.Add(Language.StringByID(StringId.AC)); |
| | | } |
| | | var floorHeating = deviceList.Find((device) => device.functionType == FunctionType.FloorHeating); |
| | | var floorHeating = deviceList.Find((device) => device.spk == SPK.FloorHeatStandard); |
| | | if (floorHeating != null) |
| | | { |
| | | deviceStrTypeList.Add(Language.StringByID(StringId.FloorHeating)); |
| | |
| | | /// </summary> |
| | | /// <param name="deviceType">设备类型(灯光类,窗帘类。)</param> |
| | | /// <returns></returns> |
| | | public static List<FunctionType> GetDeviceTypeFunctionList(string deviceType) |
| | | public static List<string> GetDeviceTypeFunctionList(string deviceType) |
| | | { |
| | | List<FunctionType> functionTypeList = new List<FunctionType>(); |
| | | List<string> functionTypeList = new List<string>(); |
| | | if (deviceType == Language.StringByID(StringId.Lights)) |
| | | { |
| | | functionTypeList.Add(FunctionType.Relay); |
| | | functionTypeList.Add(FunctionType.Dimmer); |
| | | functionTypeList.Add(FunctionType.RGB); |
| | | functionTypeList.Add(FunctionType.RGBW); |
| | | functionTypeList.Add(FunctionType.ColorTemperature); |
| | | functionTypeList.Add(SPK.LightSwitch); |
| | | functionTypeList.Add(SPK.LightDimming); |
| | | functionTypeList.Add(SPK.LightRGB); |
| | | functionTypeList.Add(SPK.LightRGBW); |
| | | functionTypeList.Add(SPK.LightCCT); |
| | | } |
| | | else if (deviceType == Language.StringByID(StringId.Curtain)) |
| | | { |
| | | functionTypeList.Add(FunctionType.Curtain); |
| | | functionTypeList.Add(FunctionType.RollingShutter); |
| | | functionTypeList.Add(FunctionType.MotorCurtain); |
| | | functionTypeList.Add(SPK.CurtainSwitch); |
| | | functionTypeList.Add(SPK.CurtainRoller); |
| | | functionTypeList.Add(SPK.CurtainTrietex); |
| | | } |
| | | else if (deviceType == Language.StringByID(StringId.AC)) |
| | | { |
| | | functionTypeList.Add(FunctionType.AC); |
| | | functionTypeList.Add(SPK.AcStandard); |
| | | } |
| | | else if (deviceType == Language.StringByID(StringId.FloorHeating)) |
| | | { |
| | | functionTypeList.Add(FunctionType.FloorHeating); |
| | | functionTypeList.Add(SPK.FloorHeatStandard); |
| | | } |
| | | return functionTypeList; |
| | | |
| | |
| | | /// 条件/目标支持设备 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static List<FunctionType> GetSupportEquipment(string if_type) |
| | | public static List<string> GetSupportEquipment(string if_type) |
| | | { |
| | | List<FunctionType> deviceTypeList = new List<FunctionType>(); |
| | | List<string> deviceTypeList = new List<string>(); |
| | | switch (if_type) |
| | | { |
| | | case condition_if: |
| | | { |
| | | deviceTypeList.Add(FunctionType.Relay); |
| | | deviceTypeList.Add(FunctionType.RGB); |
| | | deviceTypeList.Add(FunctionType.RGBW); |
| | | deviceTypeList.Add(FunctionType.Dimmer); |
| | | deviceTypeList.Add(FunctionType.ColorTemperature); |
| | | deviceTypeList.Add(FunctionType.Curtain); |
| | | deviceTypeList.Add(FunctionType.RollingShutter); |
| | | deviceTypeList.Add(FunctionType.MotorCurtain); |
| | | deviceTypeList.Add(FunctionType.AC); |
| | | deviceTypeList.Add(FunctionType.FloorHeating); |
| | | deviceTypeList.Add(SPK.LightSwitch); |
| | | deviceTypeList.Add(SPK.LightRGB); |
| | | deviceTypeList.Add(SPK.LightRGBW); |
| | | deviceTypeList.Add(SPK.LightDimming); |
| | | deviceTypeList.Add(SPK.LightCCT); |
| | | deviceTypeList.Add(SPK.CurtainSwitch); |
| | | deviceTypeList.Add(SPK.CurtainRoller); |
| | | deviceTypeList.Add(SPK.CurtainTrietex); |
| | | deviceTypeList.Add(SPK.AcStandard); |
| | | deviceTypeList.Add(SPK.FloorHeatStandard); |
| | | } |
| | | break; |
| | | case target_if: |
| | | { |
| | | deviceTypeList.Add(FunctionType.Relay); |
| | | deviceTypeList.Add(FunctionType.RGB); |
| | | deviceTypeList.Add(FunctionType.RGBW); |
| | | deviceTypeList.Add(FunctionType.Dimmer); |
| | | deviceTypeList.Add(FunctionType.ColorTemperature); |
| | | deviceTypeList.Add(FunctionType.Curtain); |
| | | deviceTypeList.Add(FunctionType.RollingShutter); |
| | | deviceTypeList.Add(FunctionType.MotorCurtain); |
| | | deviceTypeList.Add(FunctionType.AC); |
| | | deviceTypeList.Add(FunctionType.FloorHeating); |
| | | deviceTypeList.Add(SPK.LightSwitch); |
| | | deviceTypeList.Add(SPK.LightRGB); |
| | | deviceTypeList.Add(SPK.LightRGBW); |
| | | deviceTypeList.Add(SPK.LightDimming); |
| | | deviceTypeList.Add(SPK.LightCCT); |
| | | deviceTypeList.Add(SPK.CurtainSwitch); |
| | | deviceTypeList.Add(SPK.CurtainRoller); |
| | | deviceTypeList.Add(SPK.CurtainTrietex); |
| | | deviceTypeList.Add(SPK.AcStandard); |
| | | deviceTypeList.Add(SPK.FloorHeatStandard); |
| | | } |
| | | break; |
| | | } |
| | |
| | | /// <param name="functionType">源数据列表1</param> |
| | | /// <param name="deviceList">源数据列表2</param> |
| | | /// <returns></returns> |
| | | public static List<Entity.Function> GetShowDeviceList(List<FunctionType> functionType, List<HDL_ON.Entity.Function> deviceList) |
| | | public static List<Entity.Function> GetShowDeviceList(List<string> functionType, List<HDL_ON.Entity.Function> deviceList) |
| | | { |
| | | List<HDL_ON.Entity.Function> devList = new List<Entity.Function>(); |
| | | for (int i = 0; i < deviceList.Count; i++) |
| | | { |
| | | var dev = deviceList[i]; |
| | | if (functionType.Contains(dev.functionType)) |
| | | if (functionType.Contains(dev.spk)) |
| | | { |
| | | ///过滤掉不需要显示的设备 |
| | | devList.Add(dev); |
| | |
| | | /// <returns></returns> |
| | | public static List<Entity.Function> GetFunctionDeviceList(Entity.Room room, string str) |
| | | { |
| | | List<FunctionType> functionTypeList = GetSupportEquipment(str); |
| | | List<string> functionTypeList = GetSupportEquipment(str); |
| | | //返回房间设备列表 |
| | | var roomDeviceList = GetRoomDevice(room); |
| | | //返回最终支持显示出来的设备列表 |