| | |
| | | ac.DeviceStatusReport = common.DeviceStatusReport; |
| | | foreach(var attList in attriButeList) |
| | | { |
| | | var curTemp = (attList.AttriButeData / 100 < ACControlBase.Temperature_High || attList.AttriButeData / 100 > ACControlBase.Temperature_Low) ? attList.AttriButeData / 100 : ACControlBase.Temperature_Default; |
| | | var curTemp = (attList.AttriButeData / 100 < ACControlBase.Temperature_High && attList.AttriButeData / 100 > ACControlBase.Temperature_Low) ? attList.AttriButeData / 100 : ACControlBase.Temperature_Default; |
| | | switch (attList.AttributeId) |
| | | { |
| | | case 0: |
| | |
| | | functionBtn.Init(); |
| | | functionBtn.SetTitle(R.MyInternationalizationString.Function); |
| | | //自动化 |
| | | automationBtn = new ButtonLineForm(CommonFormResouce.X_Left + 150 * 2 + 20, 34, 150, 68); |
| | | automationBtn = new ButtonLineForm(CommonFormResouce.X_Left + 150 * 2 + 20+50, 34, 150, 68); |
| | | automationBtn.Init(); |
| | | automationBtn.SetTitle(R.MyInternationalizationString.Automation); |
| | | //隐藏自动化 |
| | |
| | | } |
| | | } |
| | | } |
| | | foreach (var deviceUI in sameTypeList) |
| | | for (int i=0;i<sameTypeList.Count;i++) |
| | | { |
| | | var deviceUI = sameTypeList[i]; |
| | | new System.Threading.Thread(() => |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | try |
| | | { |
| | | //删除设备 |
| | | EventHandler<MouseEventArgs> delEvent = (delSender, delE) => |
| | |
| | | { |
| | | //灯 |
| | | var light = deviceUI.CommonDevice as ToggleLight; |
| | | //补上非远程 |
| | | if (light.Gateway == null) |
| | | if (light.Gateway != null) |
| | | { |
| | | continue; |
| | | } |
| | | new System.Threading.Thread(() => |
| | | { |
| | | System.Threading.Thread.Sleep(100 * i); |
| | | if (light.Gateway.IsVirtual) |
| | | { |
| | | UserHomeView.ReadStatus(light, () => |
| | |
| | | ReadDeviceAttributeLogic.Instance.SendLightStatuComand(deviceUI.CommonDevice); |
| | | } |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | var deviceTypeRowLayout = new RowLayout() |
| | | { |
| | |
| | | Tag = deviceUI, |
| | | Radius = 0 |
| | | }; |
| | | var delBtn = new Device.CommonForm.RowLayoutDeleteButton() |
| | | var delBtn = new CommonForm.RowLayoutDeleteButton() |
| | | { |
| | | Tag = deviceUI, |
| | | Radius = 0 |
| | |
| | | delBtn.MouseUpEventHandler += delEvent; |
| | | } |
| | | } |
| | | } |
| | | else if (deviceUI.CommonDevice.Type == DeviceType.AirSwitch) |
| | | { |
| | | //空气开关 |
| | | var airSwitch = deviceUI.CommonDevice as ZigBee.Device.AirSwitch; |
| | | //补上非远程 |
| | | if (airSwitch.Gateway == null) |
| | | var airSwitch = deviceUI.CommonDevice as AirSwitch; |
| | | if (airSwitch.Gateway != null) |
| | | { |
| | | continue; |
| | | } |
| | | new System.Threading.Thread(() => |
| | | { |
| | | System.Threading.Thread.Sleep(100 * i); |
| | | if (airSwitch.Gateway.IsVirtual) |
| | | { |
| | | UserHomeView.ReadStatus(airSwitch, () => |
| | |
| | | ReadDeviceAttributeLogic.Instance.SendLightStatuComand(deviceUI.CommonDevice); |
| | | } |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | var deviceTypeRowLayout = new RowLayout() |
| | | { |
| | |
| | | Tag = deviceUI, |
| | | Radius = 0 |
| | | }; |
| | | var delBtn = new Device.CommonForm.RowLayoutDeleteButton() |
| | | var delBtn = new CommonForm.RowLayoutDeleteButton() |
| | | { |
| | | Tag = deviceUI, |
| | | Radius = 0 |
| | |
| | | deviceTypeRowLayout.AddRightView(delBtn); |
| | | delBtn.MouseUpEventHandler += delEvent; |
| | | } |
| | | |
| | | } |
| | | } |
| | | else if (deviceUI.CommonDevice.Type == DeviceType.DimmableLight) |
| | | { |
| | | //调光灯 |
| | | var dimmableLight = deviceUI.CommonDevice as ZigBee.Device.DimmableLight; |
| | | //补上非远程 |
| | | if (dimmableLight.Gateway == null) |
| | | if (dimmableLight.Gateway != null) |
| | | { |
| | | continue; |
| | | } |
| | | new System.Threading.Thread(() => |
| | | { |
| | | System.Threading.Thread.Sleep(100 * i); |
| | | if (dimmableLight.Gateway.IsVirtual) |
| | | { |
| | | UserHomeView.ReadStatus(dimmableLight, () => |
| | |
| | | ReadDeviceAttributeLogic.Instance.SendDimmableLightStatuComand(deviceUI.CommonDevice); |
| | | } |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | var deviceTypeRowLayout = new RowLayout() |
| | | { |
| | |
| | | delBtn.MouseUpEventHandler += delEvent; |
| | | } |
| | | } |
| | | } |
| | | else if (deviceUI.CommonDevice.Type == DeviceType.Thermostat) |
| | | { |
| | | //空调 |
| | | var ac = deviceUI.CommonDevice as ZigBee.Device.AC; |
| | | //补上非远程 |
| | | if (ac.Gateway == null) |
| | | if (ac.Gateway != null) |
| | | { |
| | | continue; |
| | | } |
| | | new System.Threading.Thread(() => |
| | | { |
| | | System.Threading.Thread.Sleep(100 * i); |
| | | if (ac.Gateway.IsVirtual) |
| | | { |
| | | //发送读取状态命令 |
| | |
| | | ReadDeviceAttributeLogic.Instance.SendACStatuComand(deviceUI.CommonDevice); |
| | | } |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | var deviceTypeRowLayout = new RowLayout() |
| | | { |
| | |
| | | acControl.Show(deviceUI, room); |
| | | }; |
| | | } |
| | | } |
| | | else if (deviceUI.CommonDevice.Type == DeviceType.WindowCoveringDevice) |
| | | { |
| | | //卷帘 |
| | | var rollerShade = deviceUI.CommonDevice as ZigBee.Device.Rollershade; |
| | | //不上非远程 |
| | | if (rollerShade.Gateway == null) |
| | | if (rollerShade.Gateway != null) |
| | | { |
| | | continue; |
| | | } |
| | | new System.Threading.Thread(() => |
| | | { |
| | | System.Threading.Thread.Sleep(100 * i); |
| | | if (rollerShade.Gateway.IsVirtual) |
| | | { |
| | | UserHomeView.ReadStatus(rollerShade, () => |
| | |
| | | ReadDeviceAttributeLogic.Instance.SendCurtainStatuComand(deviceUI.CommonDevice); |
| | | } |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | var deviceTypeRowLayout = new RowLayout() |
| | | { |
| | |
| | | rollerShadeControl.Show(deviceUI, room); |
| | | }; |
| | | } |
| | | } |
| | | else if (deviceUI.CommonDevice.Type == DeviceType.DoorLock) |
| | | { |
| | | var deviceTypeRowLayout = new RowLayout() |
| | |
| | | deviceRow.SetStatuText(deviceUI.GetDeviceStatu()); |
| | | deviceRow.HideSwitchBtn(true); |
| | | deviceTypeRowLayout.AddChidren(deviceRow); |
| | | |
| | | |
| | | deviceRow.ClickBtn.MouseUpEventHandler += (send2, e2) => |
| | | { |
| | |
| | | } |
| | | } |
| | | } |
| | | catch |
| | | { |
| | | |
| | | } |
| | | }); |
| | | }) |
| | | { IsBackground=true}.Start(); |
| | | } |
| | | }; |
| | | |
| | | foreach (var deviceType in Common.Room.GetdeviceTypes(room)) |