| | |
| | | |
| | | private Button StatuBtn; |
| | | |
| | | /// <summary> |
| | | /// IsDrawerLockMode |
| | | /// </summary> |
| | | public bool IsDrawerLockMode; |
| | | #endregion |
| | | |
| | | #region ◆ 接口__________________________ |
| | |
| | | } |
| | | if (deviceUI.CommonDevice.Type == DeviceType.OnOffOutput) |
| | | { |
| | | if ((common as ToggleLight).DeviceStatusReport.CluterID == 6) |
| | | if (common.DeviceStatusReport.CluterID == 6) |
| | | { |
| | | var light = deviceUI.CommonDevice as ToggleLight; |
| | | light.DeviceStatusReport = (common as ToggleLight).DeviceStatusReport; |
| | | light.DeviceStatusReport = common.DeviceStatusReport; |
| | | //记录、更新状态 |
| | | if (light.DeviceStatusReport.AttriBute == null || light.DeviceStatusReport.AttriBute.Count == 0) |
| | | { |
| | |
| | | } |
| | | else if (typeTag == "OnlineStatusChange") |
| | | { |
| | | |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | try |
| | | { |
| | | var deviceUI = device; |
| | | //设备为空 |
| | | if (deviceUI.CommonDevice == null) |
| | | { |
| | | return; |
| | | } |
| | | //是否为当前设备 |
| | | if (deviceUI.CommonDevice.DeviceEpoint != common.DeviceEpoint || deviceUI.CommonDevice.DeviceAddr != common.DeviceAddr) |
| | | { |
| | | return; |
| | | } |
| | | deviceUI.CommonDevice.IsOnline = common.IsOnline; |
| | | deviceIMG.IsSelected = switchBtn.IsSelected = deviceUI.CommonDevice.IsOnline == 1; |
| | | deviceUI.CommonDevice.LastDateTime = DateTime.Now; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | System.Console.WriteLine($"Error:{ex.Message}"); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | #endregion |
| | |
| | | public override void RemoveFromParent() |
| | | { |
| | | ZbGateway.StatusList.Remove(this); |
| | | action(); |
| | | action = null; |
| | | //action(); |
| | | //action = null; |
| | | if (IsDrawerLockMode) |
| | | { |
| | | CommonPage.Instance.IsDrawerLockMode = false; |
| | | } |
| | | RemoveUpdateControlDeviceStatuAction(); |
| | | base.RemoveFromParent(); |
| | | } |
| | |
| | | RemoveFromParent(); |
| | | }; |
| | | |
| | | var sharedBtn = new Button |
| | | { |
| | | X = Application.GetRealWidth(850), |
| | | Width = Application.GetMinReal(69), |
| | | Height = Application.GetMinReal(69), |
| | | Gravity = Gravity.CenterVertical, |
| | | UnSelectedImagePath = "Item/Shared.png" |
| | | }; |
| | | top.topView.AddChidren(sharedBtn); |
| | | |
| | | var moreBtn = new Button |
| | | { |
| | |
| | | //collection |
| | | if ((sender as Button).IsSelected) |
| | | { |
| | | Shared.Common.Room.GetLoveRoom().DeleteDevice(device.FileName); |
| | | Shared.Common.Room.CurrentRoom.GetLoveRoom().DeleteDevice(device.FileName); |
| | | (sender as Button).IsSelected = false; |
| | | } |
| | | else |
| | | { |
| | | Shared.Common.Room.GetLoveRoom().AddDevice(device.FileName); |
| | | Shared.Common.Room.CurrentRoom.GetLoveRoom().AddDevice(device.FileName); |
| | | (sender as Button).IsSelected = true; |
| | | } |
| | | } |