old mode 100644
new mode 100755
| | |
| | | /// <param name="device">Device.</param> |
| | | public static void RoomNmae(Button button, CommonDevice device) |
| | | { |
| | | var room = new Common.Room(); |
| | | button.Text = room.GetRoomNameByDevice(device); |
| | | button.Text = UserCenter.HdlRoomLogic.Current.GetRoomNameByDevice(device); |
| | | } |
| | | /// <summary> |
| | | /// 返回楼层所有的房间的列表 |
| | |
| | | public static List<Common.Room> GetRoomList(string type, string floorId = null) |
| | | { |
| | | var list = new List<Common.Room>(); |
| | | for (int i = 0; i < Common.Room.Lists.Count; i++) |
| | | var listAllRoom = UserCenter.HdlRoomLogic.Current.GetAllListRooms(); |
| | | for (int i = 0; i < listAllRoom.Count; i++) |
| | | { |
| | | if (type == "action_logicscene" || type == "action_lockscene") |
| | | { |
| | | if (Common.Room.Lists[i].SceneUIList.Count == 0) |
| | | if (listAllRoom[i].ListSceneId.Count == 0) |
| | | { ///过滤掉没有场景的房间 |
| | | continue; |
| | | } |
| | |
| | | { |
| | | ///区分出输入条件和输出目标设备 |
| | | var listdevicetype = GetDevice(type); |
| | | var listdevice = GetDeviceUIList(Common.Room.Lists[i], listdevicetype); |
| | | var listdevice = GetDeviceUIList(listAllRoom[i], listdevicetype); |
| | | if (listdevice.Count == 0) |
| | | { |
| | | ///过滤掉没有设备的房间 |
| | | continue; |
| | | } |
| | | } |
| | | list.Add(Common.Room.Lists[i]); |
| | | list.Add(listAllRoom[i]); |
| | | } |
| | | if (string.IsNullOrEmpty(floorId)) |
| | | { |
| | |
| | | /// <param name="room">当前房间</param> |
| | | /// <param name="deviceTypelist">设备类型</param> |
| | | /// <returns></returns> |
| | | public static List<DeviceUI> GetDeviceUIList(Common.Room room, List<DeviceType> deviceTypelist) |
| | | public static List<CommonDevice> GetDeviceUIList(Common.Room room, List<DeviceType> deviceTypelist) |
| | | { |
| | | var deviceUIlist = new List<DeviceUI>(); |
| | | foreach (var device in room.DeviceUIList) |
| | | var deviceUIlist = new List<CommonDevice>(); |
| | | foreach (var deviceKey in room.ListDevice) |
| | | { |
| | | if (device.CommonDevice == null) |
| | | var device = LocalDevice.Current.GetDevice(deviceKey); |
| | | if (device == null) |
| | | { |
| | | continue; |
| | | } |
| | | if (!deviceTypelist.Contains(device.CommonDevice.Type)) |
| | | if (!deviceTypelist.Contains(device.Type)) |
| | | { |
| | | //过滤掉不支持的设备 |
| | | continue; |
| | |
| | | /// <param name="type">判断字符串</param> |
| | | /// <param name="devicelist">设备列表</param> |
| | | /// <returns></returns> |
| | | public static List<string> GetDeviceTypeList(string type, List<DeviceUI> devicelist) |
| | | public static List<string> GetDeviceTypeList(string type, List<CommonDevice> devicelist) |
| | | { |
| | | List<string> devicetypelist = new List<string>(); |
| | | devicetypelist.Clear(); |
| | | var lightjosn = devicelist.Find((device) => device.CommonDevice.Type == DeviceType.ColorDimmableLight || device.CommonDevice.Type == DeviceType.OnOffOutput); |
| | | var lightjosn = devicelist.Find((device) => device.Type == DeviceType.ColorDimmableLight || device.Type == DeviceType.OnOffOutput); |
| | | if (lightjosn != null) |
| | | { |
| | | devicetypelist.Add(Language.StringByID(MyInternationalizationString.Lights)); |
| | | } |
| | | var iASZonejosn = devicelist.Find((device) => device.CommonDevice.Type == DeviceType.IASZone || device.CommonDevice.Type == DeviceType.TemperatureSensor); |
| | | var iASZonejosn = devicelist.Find((device) => device.Type == DeviceType.IASZone || device.Type == DeviceType.TemperatureSensor); |
| | | if (iASZonejosn != null) |
| | | { |
| | | devicetypelist.Add(Language.StringByID(MyInternationalizationString.sensor)); |
| | | } |
| | | var onOffSwitchjson = devicelist.Find((device) => device.CommonDevice.Type == DeviceType.OnOffSwitch); |
| | | var onOffSwitchjson = devicelist.Find((device) => device.Type == DeviceType.OnOffSwitch); |
| | | if (onOffSwitchjson != null) |
| | | { |
| | | devicetypelist.Add(Language.StringByID(MyInternationalizationString.OnOffSwitch)); |
| | | } |
| | | var doorLock = devicelist.Find((device) => device.CommonDevice.Type == DeviceType.DoorLock); |
| | | var doorLock = devicelist.Find((device) => device.Type == DeviceType.DoorLock); |
| | | if (doorLock != null) |
| | | { |
| | | devicetypelist.Add(Language.StringByID(MyInternationalizationString.doorLock)); |
| | | } |
| | | var curtainjosn = devicelist.Find((device) => device.CommonDevice.Type == DeviceType.WindowCoveringDevice); |
| | | var curtainjosn = devicelist.Find((device) => device.Type == DeviceType.WindowCoveringDevice); |
| | | if (curtainjosn != null) |
| | | { |
| | | devicetypelist.Add(Language.StringByID(MyInternationalizationString.Curtains)); |
| | | } |
| | | var ac = devicelist.Find((device) => device.CommonDevice.Type == DeviceType.Thermostat); |
| | | var ac = devicelist.Find((device) => device.Type == DeviceType.Thermostat); |
| | | if (ac != null) |
| | | { |
| | | devicetypelist.Add(Language.StringByID(MyInternationalizationString.AC)); |
| | | } |
| | | var airSwitch = devicelist.Find((device) => device.CommonDevice.Type == DeviceType.AirSwitch); |
| | | var airSwitch = devicelist.Find((device) => device.Type == DeviceType.AirSwitch); |
| | | if (airSwitch != null) |
| | | { |
| | | devicetypelist.Add(Language.StringByID(MyInternationalizationString.Airswitch)); |
| | |
| | | /// </summary> |
| | | /// <param name="device">设备对象</param> |
| | | /// <param name="button">显示图标的控件</param> |
| | | public static void GetDeviceIcon(DeviceUI device, Button button) |
| | | public static void GetDeviceIcon(CommonDevice device, Button button) |
| | | { |
| | | string patm = ""; |
| | | string selectedpatm = ""; |
| | | switch (device.CommonDevice.Type) |
| | | switch (device.Type) |
| | | { |
| | | case DeviceType.OnOffOutput: |
| | | { |
| | |
| | | break; |
| | | case DeviceType.IASZone: |
| | | { |
| | | var iASZonedevice = device.CommonDevice as IASZone; |
| | | var iASZonedevice = device as IASZone; |
| | | if (iASZonedevice.DeviceID != 1026) |
| | | { |
| | | break; |
| | |
| | | break; |
| | | case DeviceType.TemperatureSensor: |
| | | { |
| | | var temperatureSensor = device.CommonDevice as TemperatureSensor; |
| | | var temperatureSensor = device as TemperatureSensor; |
| | | if (temperatureSensor.SensorDiv == 1) |
| | | { |
| | | patm = $"ZigeeLogic/temperature.png"; |