| | |
| | | using System.Collections.Generic; |
| | | using Shared.Common; |
| | | using Shared.Phone.Device.CommonForm; |
| | | using Shared.Phone.Device.DeviceLogic; |
| | | using Shared.Phone.UserView; |
| | | using ZigBee.Device; |
| | | namespace Shared.Phone.Device.Light |
| | |
| | | /// <summary> |
| | | /// The action. |
| | | /// </summary> |
| | | public Action action; |
| | | public Action<DeviceUI, Common.Room> action; |
| | | |
| | | /// <summary> |
| | | /// The light image. |
| | |
| | | } |
| | | light.OnOffStatus = light.DeviceStatusReport.AttriBute[0].AttriButeData; |
| | | deviceIMG.IsSelected = switchBtn.IsSelected = light.OnOffStatus == 1; |
| | | StatuBtn.Text = CommonFormResouce.GetSwitchStatu(deviceIMG.IsSelected); |
| | | StatuBtn.Text = $"{Language.StringByID(R.MyInternationalizationString.Current)} {device.GetDeviceStatu()}"; |
| | | light.LastDateTime = DateTime.Now; |
| | | } |
| | | } |
| | |
| | | return; |
| | | } |
| | | deviceUI.CommonDevice.IsOnline = common.IsOnline; |
| | | deviceIMG.IsSelected = switchBtn.IsSelected = deviceUI.CommonDevice.IsOnline == 1; |
| | | //deviceIMG.IsSelected = switchBtn.IsSelected = deviceUI.CommonDevice.IsOnline == 1; |
| | | deviceUI.CommonDevice.LastDateTime = DateTime.Now; |
| | | } |
| | | catch (Exception ex) |
| | |
| | | public override void RemoveFromParent() |
| | | { |
| | | ZbGateway.StatusList.Remove(this); |
| | | //action(); |
| | | //action = null; |
| | | action(device, room); |
| | | action = null; |
| | | RemoveUpdateControlDeviceStatuAction(); |
| | | if (IsDrawerLockMode) |
| | | { |
| | |
| | | { |
| | | UserHomeView.ReadStatus(light, () => |
| | | { |
| | | light.ReadOnOffStatus(); |
| | | light.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch); |
| | | ReadDeviceAttributeLogic.Instance.SendLightStatuComand(device.CommonDevice); |
| | | }); |
| | | } |
| | | else |
| | |
| | | //防止短时间内多次读取状态 |
| | | if (CommonPage.ReadDeviceStatuSpan < (DateTime.Now - light.LastDateTime).TotalSeconds) |
| | | { |
| | | light.ReadOnOffStatus(); |
| | | light.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch); |
| | | ReadDeviceAttributeLogic.Instance.SendLightStatuComand(device.CommonDevice); |
| | | } |
| | | } |
| | | |
| | | var de = Shared.Common.Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName); |
| | | if (de == null) |
| | | if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false) |
| | | { |
| | | collectionBtn.IsSelected = false; |
| | | } |
| | |
| | | Width = Application.GetRealWidth(500), |
| | | Height = Application.GetRealHeight(60), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Text = device.CommonDevice.DeviceEpointName, |
| | | Text = Common.LocalDevice.Current.GetDeviceEpointName(device.CommonDevice), |
| | | TextColor = ZigbeeColor.Current.GXCTextBlackColor, |
| | | TextSize = 15 |
| | | TextSize = 15, |
| | | IsBold=true |
| | | }; |
| | | itemView.AddChidren(deviceNameBtn); |
| | | |
| | |
| | | Height = Application.GetRealHeight(60), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | TextColor = ZigbeeColor.Current.GXCTextGrayColor, |
| | | Text = CommonFormResouce.GetSwitchStatu(device.CommonDevice.IsOnline == 1) |
| | | Text = $"{Language.StringByID(R.MyInternationalizationString.Current)} {device.GetDeviceStatu()}", |
| | | TextSize = 10 |
| | | }; |
| | | itemView.AddChidren(StatuBtn); |
| | | |
| | |
| | | Height = Application.GetRealHeight(50), |
| | | Text = room.Name, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = ZigbeeColor.Current.GXCTextWhiteColor |
| | | TextColor = ZigbeeColor.Current.GXCTextWhiteColor, |
| | | TextSize=12 |
| | | }; |
| | | itemView.AddChidren(roomName); |
| | | } |
| | |
| | | zbGateway.ReportAction += UpdateDeviceControllStatu; |
| | | switchBtn.IsSelected = !switchBtn.IsSelected; |
| | | deviceIMG.IsSelected = !deviceIMG.IsSelected; |
| | | StatuBtn.Text = CommonFormResouce.GetSwitchStatu(deviceIMG.IsSelected); |
| | | StatuBtn.Text = deviceIMG.IsSelected ? $"{Language.StringByID(R.MyInternationalizationString.Current)} {Language.StringByID(R.MyInternationalizationString.Open)}" : $"{Language.StringByID(R.MyInternationalizationString.Current)} {Language.StringByID(R.MyInternationalizationString.Shut)}"; |
| | | if (switchBtn.IsSelected == true) |
| | | { |
| | | (device.CommonDevice as ToggleLight).SwitchControl(1); |
| | |
| | | UserView.HomePage.Instance.AddChidren(detailInfo); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | detailInfo.Show(device, room); |
| | | detailInfo.action = () => |
| | | detailInfo.EditAction += (curDev, curRoom) => |
| | | { |
| | | Show(device, room); |
| | | Show(curDev, curRoom); |
| | | }; |
| | | } |
| | | |