| | |
| | | /// <summary> |
| | | /// The action. |
| | | /// </summary> |
| | | public Action action; |
| | | public Action<CommonDevice, Common.Room> action; |
| | | ///// <summary> |
| | | ///// The top view. |
| | | ///// </summary> |
| | |
| | | /// <summary> |
| | | /// 传过来的设备 |
| | | /// </summary> |
| | | private DeviceUI device; |
| | | private CommonDevice device; |
| | | /// <summary> |
| | | /// 传过来的ac |
| | | /// </summary> |
| | |
| | | /// 收藏按钮 |
| | | /// </summary> |
| | | private Button collectionBtn; |
| | | |
| | | |
| | | /// <summary> |
| | | /// 开关 |
| | | /// </summary> |
| | |
| | | /// 滑条 |
| | | /// </summary> |
| | | private WaveSeekBar levelSeekBar; |
| | | |
| | | |
| | | |
| | | private Button StatuBtn; |
| | | /// <summary> |
| | |
| | | /// IsDrawerLockMode |
| | | /// </summary> |
| | | public bool IsDrawerLockMode; |
| | | /// <summary> |
| | | /// ProgressBtn |
| | | /// </summary> |
| | | Button ProgressBtn; |
| | | /// <summary> |
| | | /// ProgressBtnY |
| | | /// </summary> |
| | | int ProgressBtnY; |
| | | |
| | | #endregion |
| | | |
| | | #region ◆ 接口__________________________ |
| | | /// <summary> |
| | | /// 处理变化事件 --将弃用 改用DeviceInfoChange() |
| | | /// </summary> |
| | | /// <returns>The changed.</returns> |
| | | /// <param name="common">Common.</param> |
| | | public void Changed(CommonDevice common) |
| | | { |
| | | |
| | | } |
| | | /// <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(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设备状态更新接口 |
| | | /// <para>type:如果为 DeviceInComingRespon:设备新上报</para> |
| | |
| | | { |
| | | var deviceUI = 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 (deviceUI.CommonDevice.Type == DeviceType.DimmableLight) |
| | | if (deviceUI.Type == DeviceType.DimmableLight) |
| | | { |
| | | if (common.DeviceStatusReport.CluterID == 6) |
| | | { |
| | | dimmableLight = deviceUI.CommonDevice as DimmableLight; |
| | | dimmableLight = deviceUI as DimmableLight; |
| | | dimmableLight.DeviceStatusReport = common.DeviceStatusReport; |
| | | //记录、更新状态 |
| | | if (dimmableLight.DeviceStatusReport.AttriBute == null || dimmableLight.DeviceStatusReport.AttriBute.Count == 0) |
| | | { |
| | | return; |
| | | } |
| | | dimmableLight.OnOffStatus = dimmableLight.DeviceStatusReport.AttriBute[0].AttriButeData; |
| | | switchBtn.IsSelected = dimmableLight.OnOffStatus == 1; |
| | | StatuBtn.Text = CommonFormResouce.GetSwitchStatu(switchBtn.IsSelected); |
| | | StatuBtn.Text = switchBtn.IsSelected ? $"{Language.StringByID(R.MyInternationalizationString.CurrentLightLevel)} {UserCenter.HdlDeviceOtherLogic.Current.GetDeviceStatu(device)}" : $"{Language.StringByID(R.MyInternationalizationString.Current)} {Language.StringByID(R.MyInternationalizationString.Shut)}"; |
| | | |
| | | if (switchBtn.IsSelected == true) |
| | | { |
| | | levelSeekBar.IsClickable = true; |
| | | levelSeekBar.WaveColor = ZigbeeColor.Current.GXCWaveSeekBarColor; |
| | | //levelSeekBar.Progress = 100; |
| | | levelSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarColor_Start, ZigbeeColor.Current.GXCWaveSeekBarColor_End); |
| | | } |
| | | else |
| | | { |
| | | levelSeekBar.IsClickable = false; |
| | | levelSeekBar.WaveColor = ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor; |
| | | //levelSeekBar.Progress = 0; |
| | | levelSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor, ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor); |
| | | } |
| | | //change color |
| | | dimmableLight.LastDateTime = DateTime.Now; |
| | | } |
| | | //亮度 |
| | | if (common.DeviceStatusReport.CluterID == 8) |
| | | { |
| | | dimmableLight = deviceUI.CommonDevice as ZigBee.Device.DimmableLight; |
| | | dimmableLight = deviceUI as ZigBee.Device.DimmableLight; |
| | | dimmableLight.DeviceStatusReport = common.DeviceStatusReport; |
| | | var attriButeList = dimmableLight.DeviceStatusReport.AttriBute; |
| | | if (attriButeList == null || attriButeList.Count == 0) |
| | |
| | | dimmableLight.Level = attriButeList[0].AttriButeData; |
| | | dimmableLight.LastDateTime = DateTime.Now; |
| | | levelSeekBar.Progress = (int)(dimmableLight.Level*1.0/MaxLevel*100); |
| | | StatuBtn.Text = switchBtn.IsSelected ? $"{Language.StringByID(R.MyInternationalizationString.CurrentLightLevel)} { UserCenter.HdlDeviceOtherLogic.Current.GetDeviceStatu(device)}" : $"{Language.StringByID(R.MyInternationalizationString.Current)} {Language.StringByID(R.MyInternationalizationString.Shut)}"; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | } |
| | | else if (typeTag == "OnlineStatusChange") |
| | | { |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | ZbGateway.StatusList.Remove(this); |
| | | UserView.HomePage.Instance.ScrollEnabled = true; |
| | | //action(); |
| | | //action = null; |
| | | action(device, room); |
| | | action = null; |
| | | if (IsDrawerLockMode) |
| | | { |
| | | CommonPage.Instance.IsDrawerLockMode = false; |
| | |
| | | /// </summary> |
| | | /// <param name="device">Device.</param> |
| | | /// <param name="room">Room.</param> |
| | | public void Show(DeviceUI device, Shared.Common.Room room) |
| | | public void Show(CommonDevice device, Shared.Common.Room room) |
| | | { |
| | | this.device = device; |
| | | this.room = room; |
| | | this.dimmableLight = device.CommonDevice as ZigBee.Device.DimmableLight; |
| | | this.dimmableLight = device as ZigBee.Device.DimmableLight; |
| | | |
| | | //添加topview |
| | | AddTopView(); |
| | |
| | | //发送读取状态命令 |
| | | UserView.UserHomeView.ReadStatus(dimmableLight, () => |
| | | { |
| | | ReadDeviceAttributeLogic.Instance.SendDimmableLightStatuComand(device.CommonDevice); |
| | | ReadDeviceAttributeLogic.Instance.SendDimmableLightStatuComand(device); |
| | | }); |
| | | } |
| | | else |
| | |
| | | //防止短时间内多次读取设备状态 |
| | | if ((DateTime.Now - dimmableLight.LastDateTime).TotalSeconds > CommonPage.ReadDeviceStatuSpan) |
| | | { |
| | | ReadDeviceAttributeLogic.Instance.SendDimmableLightStatuComand(device.CommonDevice); |
| | | ReadDeviceAttributeLogic.Instance.SendDimmableLightStatuComand(device); |
| | | } |
| | | } |
| | | } |
| | |
| | | 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); |
| | | }; |
| | | } |
| | | |
| | |
| | | /// <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 |
| | | TextSize = 15, |
| | | IsBold=true |
| | | }; |
| | | itemView.AddChidren(deviceNameBtn); |
| | | |
| | |
| | | Height = Application.GetRealHeight(60), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | TextColor = ZigbeeColor.Current.GXCTextGrayColor, |
| | | Text = CommonFormResouce.GetSwitchStatu((device.CommonDevice as DimmableLight).OnOffStatus == 1) |
| | | Text = dimmableLight.Level>0?$"{Language.StringByID(R.MyInternationalizationString.CurrentLightLevel)} { UserCenter.HdlDeviceOtherLogic.Current.GetDeviceStatu(device)}" :$"{Language.StringByID(R.MyInternationalizationString.Current)} {Language.StringByID(R.MyInternationalizationString.Shut)}", |
| | | TextSize=10 |
| | | }; |
| | | |
| | | itemView.AddChidren(StatuBtn); |
| | | |
| | | levelSeekBar = new WaveSeekBar() |
| | |
| | | Width = Application.GetRealWidth(271), |
| | | Height = Application.GetRealHeight(533), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | WavePadding = 2, |
| | | WavePadding = Application.GetRealWidth(8), |
| | | MaxValue=100, |
| | | Progress = (int)(dimmableLight.Level*1.0/MaxLevel*100), |
| | | WaveColor = ZigbeeColor.Current.GXCWaveSeekBarColor |
| | | |
| | | CornerRadius= Application.GetRealHeight(58) |
| | | }; |
| | | |
| | | itemView.AddChidren(levelSeekBar); |
| | | |
| | | if (dimmableLight.OnOffStatus == 1) |
| | | { |
| | | levelSeekBar.IsClickable = true; |
| | | levelSeekBar.WaveColor = ZigbeeColor.Current.GXCWaveSeekBarColor; |
| | | levelSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarColor_Start, ZigbeeColor.Current.GXCWaveSeekBarColor_End); |
| | | } |
| | | else |
| | | { |
| | | levelSeekBar.IsClickable = false; |
| | | levelSeekBar.WaveColor = ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor; |
| | | levelSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor, ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor); |
| | | } |
| | | |
| | | levelSeekBar.OnStartTrackingTouchEvent += (sender, e) => |
| | | { |
| | | OnProgressButtonMove(levelSeekBar.Progress); |
| | | levelSeekBar.IsProgressTextShow = false; |
| | | ProgressBtn.Visible = true; |
| | | }; |
| | | |
| | | levelSeekBar.OnStopTrackingTouchEvent += (sender, e) => |
| | | { |
| | | ProgressBtn.Visible = false; |
| | | levelSeekBar.IsProgressTextShow = true; |
| | | dimmableLight.SetLevel((int)(levelSeekBar.Progress * MaxLevel / 100.0)); |
| | | }; |
| | | |
| | | levelSeekBar.OnProgressChangedEvent += (send2, e2) => |
| | | { |
| | | dimmableLight.SetLevel((int)(levelSeekBar.Progress * MaxLevel / 100.0)); |
| | | |
| | | OnProgressButtonMove(e2); |
| | | |
| | | //判断是否300ms屏蔽 |
| | | //if (levelSeekBar.IsProgressChangeDelay()) return; |
| | | //dimmableLight.SetLevel((int)(levelSeekBar.Progress * MaxLevel / 100.0)); |
| | | }; |
| | | |
| | | InitProgressBtn(itemView); |
| | | |
| | | switchBtn = new Button() |
| | | { |
| | |
| | | Gravity = Gravity.CenterHorizontal, |
| | | UnSelectedImagePath = "Item/Switch.png", |
| | | SelectedImagePath = "Item/SwitchSelected.png", |
| | | IsSelected = (device.CommonDevice as DimmableLight).OnOffStatus == 1 |
| | | IsSelected = (device as DimmableLight).OnOffStatus == 1 |
| | | }; |
| | | itemView.AddChidren(switchBtn); |
| | | |
| | |
| | | Height = Application.GetRealHeight(50), |
| | | Text = room.Name, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = ZigbeeColor.Current.GXCTextWhiteColor |
| | | TextColor = ZigbeeColor.Current.GXCTextWhiteColor, |
| | | TextSize = 12 |
| | | }; |
| | | itemView.AddChidren(roomName); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// OnProgressButtonMove |
| | | /// </summary> |
| | | private void OnProgressButtonMove(int mProgress) |
| | | { |
| | | ProgressBtn.Y = ProgressBtnY + levelSeekBar.NowProgressY; |
| | | ProgressBtn.Text = mProgress + "%"; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 添加进度按钮 |
| | | /// </summary> |
| | | private void InitProgressBtn(FrameLayout layout) |
| | | { |
| | | ProgressBtnY = levelSeekBar.Y - Application.GetMinReal(154); |
| | | ProgressBtn = new Button() |
| | | { |
| | | Y = ProgressBtnY, |
| | | Width = Application.GetMinReal(135), |
| | | Height = Application.GetMinReal(104), |
| | | UnSelectedImagePath = "Item/ProgressBubbles.png", |
| | | Visible = false, |
| | | Gravity = Gravity.CenterHorizontal, |
| | | TextSize = 14, |
| | | IsBold = true, |
| | | TextColor = ZigbeeColor.Current.GXCTextWhiteColor |
| | | }; |
| | | layout.AddChidren(ProgressBtn); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | private void Switch_MouseUpEvent(object sender, MouseEventArgs eventArgs) |
| | | { |
| | | switchBtn.IsSelected = !switchBtn.IsSelected; |
| | | StatuBtn.Text = CommonFormResouce.GetSwitchStatu(switchBtn.IsSelected); |
| | | StatuBtn.Text = switchBtn.IsSelected ? $"{Language.StringByID(R.MyInternationalizationString.CurrentLightLevel)} { UserCenter.HdlDeviceOtherLogic.Current.GetDeviceStatu(device)}" : $"{Language.StringByID(R.MyInternationalizationString.Current)} {Language.StringByID(R.MyInternationalizationString.Shut)}"; |
| | | if (switchBtn.IsSelected == true) |
| | | { |
| | | dimmableLight.SwitchControl(1); |
| | | levelSeekBar.IsClickable = true; |
| | | levelSeekBar.WaveColor = ZigbeeColor.Current.GXCWaveSeekBarColor; |
| | | levelSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarColor_Start, ZigbeeColor.Current.GXCWaveSeekBarColor_End); |
| | | } |
| | | else |
| | | { |
| | | dimmableLight.SwitchControl(0); |
| | | levelSeekBar.IsClickable = false; |
| | | levelSeekBar.WaveColor = ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor; |
| | | levelSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor, ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor); |
| | | } |
| | | } |
| | | |
| | |
| | | /// </summary> |
| | | private void InitCollection() |
| | | { |
| | | var dev = Shared.Common.Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName); |
| | | if (dev == null) |
| | | if (UserCenter.HdlRoomLogic.Current.IsCollectInRoom(device) == false) |
| | | { |
| | | collectionBtn.IsSelected = false; |
| | | } |
| | |
| | | //collection |
| | | if ((sender as Button).IsSelected) |
| | | { |
| | | Shared.Common.Room.CurrentRoom.GetLoveRoom().DeleteDevice(device.FileName); |
| | | UserCenter.HdlRoomLogic.Current.DeleteLoveDevice(device); |
| | | (sender as Button).IsSelected = false; |
| | | } |
| | | else |
| | | { |
| | | Shared.Common.Room.CurrentRoom.GetLoveRoom().AddDevice(device.FileName); |
| | | {
|
| | | UserCenter.HdlRoomLogic.Current.AddLoveDevice(device); |
| | | (sender as Button).IsSelected = true; |
| | | } |
| | | } |