| | |
| | | /// <summary> |
| | | /// The action. |
| | | /// </summary> |
| | | public Action action; |
| | | public Action<CommonDevice, Common.Room> action; |
| | | |
| | | /// <summary> |
| | | /// 收藏按钮 |
| | |
| | | /// <summary> |
| | | /// 传过来的设备 |
| | | /// </summary> |
| | | private DeviceUI device; |
| | | private CommonDevice device; |
| | | /// <summary> |
| | | /// 传过来的房间 |
| | | /// </summary> |
| | |
| | | #endregion |
| | | |
| | | #region ◆ 接口___________________________ |
| | | /// <summary> |
| | | /// 处理变化事件 --将弃用 改用DeviceInfoChange() |
| | | /// </summary> |
| | | /// <returns>The changed.</returns> |
| | | /// <param name="common">Common.</param> |
| | | public void Changed(CommonDevice common) |
| | | { |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 设备状态更新接口 |
| | | /// <para>type:如果为 DeviceInComingRespon:设备新上报</para> |
| | |
| | | { |
| | | var deviceUI = this.device; |
| | | //设备为空 |
| | | if (deviceUI.CommonDevice == null) |
| | | if (deviceUI == null) |
| | | { |
| | | return; |
| | | } |
| | | //是否为当前设备 |
| | | if (deviceUI.CommonDevice.DeviceEpoint != common.DeviceEpoint || deviceUI.CommonDevice.DeviceAddr != common.DeviceAddr) |
| | | if (deviceUI.DeviceEpoint != common.DeviceEpoint || deviceUI.DeviceAddr != common.DeviceAddr) |
| | | { |
| | | return; |
| | | } |
| | |
| | | if (common.DeviceStatusReport.AttriBute[0].AttributeId == 8) |
| | | { |
| | | //窗帘百分比 |
| | | var rollerShade = deviceUI.CommonDevice as Rollershade; |
| | | var rollerShade = deviceUI as Rollershade; |
| | | rollerShade.DeviceStatusReport = common.DeviceStatusReport; |
| | | rollerShade.WcdCurrentPositionLiftPercentage = common.DeviceStatusReport.AttriBute[0].AttriButeData; |
| | | StatuBtn.Text = $"{Language.StringByID(R.MyInternationalizationString.Current)} { deviceUI.GetDeviceStatu()}"; |
| | | StatuBtn.Text = $"{Language.StringByID(R.MyInternationalizationString.Current)} { UserCenter.HdlDeviceOtherLogic.Current.GetDeviceStatu(deviceUI)}"; |
| | | if(rollerShade.WcdType==0) |
| | | { |
| | | curtainRollSeekBar.Progress = rollerShade.WcdCurrentPositionLiftPercentage; |
| | |
| | | else if (common.DeviceStatusReport.AttriBute[0].AttributeId == 0) |
| | | { |
| | | ////窗帘类型 |
| | | var rollerShade = device.CommonDevice as Rollershade; |
| | | var rollerShade = device as Rollershade; |
| | | rollerShade.DeviceStatusReport = common.DeviceStatusReport; |
| | | rollerShade.WcdType = common.DeviceStatusReport.AttriBute[0].AttriButeData; |
| | | rollerShade.LastDateTime = DateTime.Now; |
| | |
| | | }); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// Changeds the IL ogic status. |
| | | /// </summary> |
| | | /// <param name="logic">Logic.</param> |
| | | public void ChangedILogicStatus(ZigBee.Device.Logic logic) |
| | | { |
| | | //throw new NotImplementedException(); |
| | | } |
| | | /// <summary> |
| | | /// Changeds the IS cene status. |
| | | /// </summary> |
| | | /// <param name="scene">Scene.</param> |
| | | public void ChangedISceneStatus(Scene scene)
|
| | | {
|
| | | //throw new NotImplementedException(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ◆ 构造方法________________________ |
| | |
| | | { |
| | | UserView.HomePage.Instance.ScrollEnabled = true; |
| | | ZigBee.Device.ZbGateway.StatusList.Remove(this); |
| | | //action(); |
| | | //action = null; |
| | | action(device,room); |
| | | action = null; |
| | | RemoveUpdateControlDeviceStatuAction(); |
| | | if (IsDrawerLockMode) |
| | | { |
| | |
| | | /// </summary> |
| | | /// <param name="dev">Device.</param> |
| | | /// <param name="room">Room.</param> |
| | | public void Show(DeviceUI dev, Shared.Common.Room room) |
| | | public void Show(CommonDevice dev, Shared.Common.Room room) |
| | | { |
| | | device = dev; |
| | | zbGateway = this.device.CommonDevice.Gateway; |
| | | zbGateway = this.device.Gateway; |
| | | this.room = room; |
| | | |
| | | AddTop(); |
| | |
| | | AddBodyView(device); |
| | | |
| | | |
| | | var rollerShade = device.CommonDevice as ZigBee.Device.Rollershade; |
| | | var rollerShade = device as ZigBee.Device.Rollershade; |
| | | //不上非远程 |
| | | if (rollerShade.Gateway == null) |
| | | { |
| | |
| | | { |
| | | UserHomeView.ReadStatus(rollerShade, () => |
| | | { |
| | | ReadDeviceAttributeLogic.Instance.SendCurtainStatuComand(device.CommonDevice); |
| | | ReadDeviceAttributeLogic.Instance.SendCurtainStatuComand(device); |
| | | }); |
| | | } |
| | | else |
| | |
| | | //防止短时间内多次读取 |
| | | if ((DateTime.Now - rollerShade.LastDateTime).TotalSeconds > CommonPage.ReadDeviceStatuSpan) |
| | | { |
| | | ReadDeviceAttributeLogic.Instance.SendCurtainStatuComand(device.CommonDevice); |
| | | ReadDeviceAttributeLogic.Instance.SendCurtainStatuComand(device); |
| | | } |
| | | } |
| | | |
| | | var de = Shared.Common.Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName); |
| | | if (de == null) |
| | | if (UserCenter.HdlRoomLogic.Current.IsCollectInRoom(device) == false) |
| | | { |
| | | collectionBtn.IsSelected = false; |
| | | } |
| | |
| | | /// <summary> |
| | | /// AddBodyView |
| | | /// </summary> |
| | | public void AddBodyView(DeviceUI device) |
| | | public void AddBodyView(CommonDevice device) |
| | | { |
| | | bodyFrameLayout = new FrameLayout() |
| | | { |
| | |
| | | Width = Application.GetRealWidth(500), |
| | | Height = Application.GetRealHeight(60), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Text = device.CommonDevice.DeviceEpointName, |
| | | Text = Common.LocalDevice.Current.GetDeviceEpointName(device), |
| | | TextColor = ZigbeeColor.Current.GXCTextBlackColor, |
| | | TextSize = 15, |
| | | IsBold=true |
| | |
| | | Height = Application.GetRealHeight(60), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | TextColor = ZigbeeColor.Current.GXCTextGrayColor, |
| | | Text = $"{Language.StringByID(R.MyInternationalizationString.Current)} {device.GetDeviceStatu()}", |
| | | Text = $"{Language.StringByID(R.MyInternationalizationString.Current)} {UserCenter.HdlDeviceOtherLogic.Current.GetDeviceStatu(device)}", |
| | | TextSize = 10 |
| | | }; |
| | | itemView.AddChidren(StatuBtn); |
| | |
| | | itemView.AddChidren(OpenOrUpBtn); |
| | | OpenOrUpBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | (device.CommonDevice as Rollershade).CurtainUpDownStopControl(0); |
| | | (device as Rollershade).CurtainUpDownStopControl(0); |
| | | }; |
| | | |
| | | StopBtn = new Button |
| | |
| | | itemView.AddChidren(StopBtn); |
| | | StopBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | (device.CommonDevice as Rollershade).CurtainUpDownStopControl(2); |
| | | (device as Rollershade).CurtainUpDownStopControl(2); |
| | | }; |
| | | |
| | | CloseOrDownBtn = new Button |
| | |
| | | itemView.AddChidren(CloseOrDownBtn); |
| | | CloseOrDownBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | (device.CommonDevice as Rollershade).CurtainUpDownStopControl(1); |
| | | (device as Rollershade).CurtainUpDownStopControl(1); |
| | | }; |
| | | |
| | | if ((device.CommonDevice as Rollershade).WcdType == -1) |
| | | if ((device as Rollershade).WcdType == -1) |
| | | { |
| | | CommonPage.Loading.Start(); |
| | | new System.Threading.Thread(() => |
| | | { |
| | | Rollershade.ReadWcdTypeAction(device.CommonDevice, () => |
| | | Rollershade.ReadWcdTypeAction(device, () => |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | SetRollerShadeIcon((device.CommonDevice as Rollershade).WcdType); |
| | | SetRollerShadeIcon((device as Rollershade).WcdType); |
| | | CommonPage.Loading.Hide(); |
| | | }); |
| | | }); |
| | |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | SetCurtainType(itemView, (device.CommonDevice as Rollershade).WcdType); |
| | | SetCurtainType(itemView, (device as Rollershade).WcdType); |
| | | |
| | | var roomBG = new Button |
| | | { |
| | |
| | | { |
| | | sendedControlCommand = false; |
| | | zbGateway.ReportAction += UpdateDeviceControllStatu; |
| | | (device.CommonDevice as ZigBee.Device.Rollershade).CurtainUpDownStopControl(0); |
| | | (device as ZigBee.Device.Rollershade).CurtainUpDownStopControl(0); |
| | | //控制延时回调 |
| | | DeviceUI.SendCommandDelayAction(device.CommonDevice, () => |
| | | UserCenter.HdlDeviceOtherLogic.Current.SendCommandDelayAction(device, () => |
| | | { |
| | | if (Parent == null) |
| | | { |
| | |
| | | RemoveUpdateControlDeviceStatuAction(); |
| | | if (sendedControlCommand == false) |
| | | { |
| | | DeviceUI.ShowStatuTip(R.MyInternationalizationString.FAIL); |
| | | UserCenter.HdlDeviceOtherLogic.Current.ShowStatuTip(R.MyInternationalizationString.FAIL); |
| | | } |
| | | }); |
| | | } |
| | |
| | | { |
| | | sendedControlCommand = false; |
| | | zbGateway.ReportAction += UpdateDeviceControllStatu; |
| | | (device.CommonDevice as ZigBee.Device.Rollershade).CurtainUpDownStopControl(1); |
| | | (device as ZigBee.Device.Rollershade).CurtainUpDownStopControl(1); |
| | | //控制延时回调 |
| | | DeviceUI.SendCommandDelayAction(device.CommonDevice, () => |
| | | UserCenter.HdlDeviceOtherLogic.Current.SendCommandDelayAction(device, () => |
| | | { |
| | | if (Parent == null) |
| | | { |
| | |
| | | RemoveUpdateControlDeviceStatuAction(); |
| | | if (sendedControlCommand == false) |
| | | { |
| | | DeviceUI.ShowStatuTip(R.MyInternationalizationString.FAIL); |
| | | UserCenter.HdlDeviceOtherLogic.Current.ShowStatuTip(R.MyInternationalizationString.FAIL); |
| | | } |
| | | }); |
| | | } |
| | |
| | | { |
| | | sendedControlCommand = false; |
| | | zbGateway.ReportAction += UpdateDeviceControllStatu; |
| | | (device.CommonDevice as ZigBee.Device.Rollershade).CurtainUpDownStopControl(2); |
| | | (device as ZigBee.Device.Rollershade).CurtainUpDownStopControl(2); |
| | | //控制延时回调 |
| | | DeviceUI.SendCommandDelayAction(device.CommonDevice, () => |
| | | UserCenter.HdlDeviceOtherLogic.Current.SendCommandDelayAction(device, () => |
| | | { |
| | | if (Parent == null) |
| | | { |
| | |
| | | RemoveUpdateControlDeviceStatuAction(); |
| | | if (sendedControlCommand == false) |
| | | { |
| | | DeviceUI.ShowStatuTip(R.MyInternationalizationString.FAIL); |
| | | UserCenter.HdlDeviceOtherLogic.Current.ShowStatuTip(R.MyInternationalizationString.FAIL); |
| | | } |
| | | }); |
| | | } |
| | |
| | | return; |
| | | } |
| | | var tempDevice = (CommonDevice)objValue; |
| | | if (tempDevice.DeviceEpoint != this.device.CommonDevice.DeviceEpoint || tempDevice.DeviceAddr != this.device.CommonDevice.DeviceAddr) |
| | | if (tempDevice.DeviceEpoint != this.device.DeviceEpoint || tempDevice.DeviceAddr != this.device.DeviceAddr) |
| | | { |
| | | //不是当前设备的推送,则不处理 |
| | | return; |
| | |
| | | UserView.HomePage.Instance.AddChidren(detailInfo); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | detailInfo.Show(device, room); |
| | | detailInfo.EditAction = (d,r) => |
| | | detailInfo.EditAction += (curDev,curRoom) => |
| | | { |
| | | Show(device, room); |
| | | Show(curDev, curRoom); |
| | | }; |
| | | } |
| | | |
| | |
| | | curtainRollSeekBar.Width = Application.GetRealWidth(438); |
| | | curtainRollSeekBar.Height = Application.GetRealHeight(576); |
| | | curtainRollSeekBar.Gravity = Gravity.CenterHorizontal; |
| | | curtainRollSeekBar.Progress = (device.CommonDevice as Rollershade).WcdCurrentPositionLiftPercentage; |
| | | curtainRollSeekBar.Progress = (device as Rollershade).WcdCurrentPositionLiftPercentage; |
| | | layout.AddChidren(curtainRollSeekBar); |
| | | curtainRollSeekBar.IsProgressTextShow = false; |
| | | curtainRollSeekBar.CurtainPaddingTop = Application.GetRealHeight(110); |
| | | curtainRollSeekBar.OnStopTrackingTouchEvent += (sender, e) => |
| | | { |
| | | (device.CommonDevice as Rollershade).WcdGoToTiltValue(curtainRollSeekBar.Progress); |
| | | (device as Rollershade).WcdGoToTiltValue(curtainRollSeekBar.Progress); |
| | | }; |
| | | |
| | | curtainRollSeekBar.OnStartTrackingTouchEvent += (sender, e) => |
| | |
| | | curtainSeekBar.Height = Application.GetRealHeight(513); |
| | | curtainSeekBar.Gravity = Gravity.CenterHorizontal; |
| | | curtainSeekBar.IsProgressTextShow = false; |
| | | curtainSeekBar.Progress = (device.CommonDevice as Rollershade).WcdCurrentPositionLiftPercentage; |
| | | curtainSeekBar.Progress = (device as Rollershade).WcdCurrentPositionLiftPercentage; |
| | | layout.AddChidren(curtainSeekBar); |
| | | |
| | | curtainSeekBar.OnStopTrackingTouchEvent += (sender, e) => |
| | | { |
| | | (device.CommonDevice as Rollershade).WcdGoToTiltValue(curtainSeekBar.Progress); |
| | | (device as Rollershade).WcdGoToTiltValue(curtainSeekBar.Progress); |
| | | }; |
| | | |
| | | curtainSeekBar.OnStartTrackingTouchEvent += (sender, e) => |
| | |
| | | { |
| | | if (collectionBtn.IsSelected) |
| | | { |
| | | Common.Room.CurrentRoom.GetLoveRoom().DeleteDevice(device.FileName); |
| | | UserCenter.HdlRoomLogic.Current.DeleteLoveDevice(device); |
| | | collectionBtn.IsSelected = false; |
| | | } |
| | | else |
| | | { |
| | | Common.Room.CurrentRoom.GetLoveRoom().AddDevice(device.FileName); |
| | | UserCenter.HdlRoomLogic.Current.AddLoveDevice(device); |
| | | collectionBtn.IsSelected = true; |
| | | } |
| | | } |