From 34e965100d635346e2d4cd6e6013bdaed66b3004 Mon Sep 17 00:00:00 2001 From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local> Date: 星期四, 02 一月 2020 19:52:13 +0800 Subject: [PATCH] 2019.1.2-3 --- ZigbeeApp/Shared/Phone/Device/Curtain/RollerShadeControl.cs | 180 +++++++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 147 insertions(+), 33 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/Curtain/RollerShadeControl.cs b/ZigbeeApp/Shared/Phone/Device/Curtain/RollerShadeControl.cs index acec5e6..923e1f7 100644 --- a/ZigbeeApp/Shared/Phone/Device/Curtain/RollerShadeControl.cs +++ b/ZigbeeApp/Shared/Phone/Device/Curtain/RollerShadeControl.cs @@ -1,6 +1,7 @@ 锘縰sing System; using Shared.Common; using Shared.Phone.Device.CommonForm; +using Shared.Phone.Device.DeviceLogic; using Shared.Phone.UserView; using ZigBee.Device; @@ -74,6 +75,24 @@ /// </summary> private CurtainRollSeekBar curtainRollSeekBar = new CurtainRollSeekBar { }; + /// <summary> + /// IsDrawerLockMode + /// </summary> + public bool IsDrawerLockMode; + + /// <summary> + /// ProgressBtn + /// </summary> + Button ProgressBtn; + /// <summary> + /// ProgressBtnY + /// </summary> + int ProgressBtnY; + /// <summary> + /// ProgressBtnX + /// </summary> + int ProgressBtnX; + #endregion #region 鈼� 鎺ュ彛___________________________ @@ -132,8 +151,6 @@ { curtainSeekBar.Progress = rollerShade.WcdCurrentPositionLiftPercentage; } - //SeekBar.Progress = rollerShade.WcdCurrentPositionLiftPercentage; - //seekBarTitle.Text = $"{SeekBar.Progress} %"; rollerShade.LastDateTime = DateTime.Now; } else if (common.DeviceStatusReport.AttriBute[0].AttributeId == 0) @@ -232,6 +249,10 @@ //action(); //action = null; RemoveUpdateControlDeviceStatuAction(); + if (IsDrawerLockMode) + { + CommonPage.Instance.IsDrawerLockMode = false; + } base.RemoveFromParent(); } @@ -265,8 +286,7 @@ { UserHomeView.ReadStatus(rollerShade, () => { - rollerShade.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch); - rollerShade.ReadWcdCurrentPositionLiftPercentage(); + ReadDeviceAttributeLogic.Instance.SendCurtainStatuComand(device.CommonDevice); }); } else @@ -274,8 +294,7 @@ //闃叉鐭椂闂村唴澶氭璇诲彇 if ((DateTime.Now - rollerShade.LastDateTime).TotalSeconds > CommonPage.ReadDeviceStatuSpan) { - rollerShade.ReadWcdCurrentPositionLiftPercentage(); - rollerShade.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch); + ReadDeviceAttributeLogic.Instance.SendCurtainStatuComand(device.CommonDevice); } } @@ -368,7 +387,8 @@ Gravity = Gravity.CenterHorizontal, Text = device.CommonDevice.DeviceEpointName, TextColor = ZigbeeColor.Current.GXCTextBlackColor, - TextSize = 15 + TextSize = 15, + IsBold=true }; itemView.AddChidren(deviceNameBtn); @@ -379,7 +399,8 @@ 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)} {device.GetDeviceStatu()}", + TextSize = 10 }; itemView.AddChidren(StatuBtn); @@ -443,7 +464,7 @@ } SetCurtainType(itemView, (device.CommonDevice as Rollershade).WcdType); - + var roomBG = new Button { Y = Application.GetRealHeight(1178 - 50), @@ -479,7 +500,8 @@ Height = Application.GetRealHeight(50), Text = room.Name, TextAlignment = TextAlignment.CenterLeft, - TextColor = ZigbeeColor.Current.GXCTextWhiteColor + TextColor = ZigbeeColor.Current.GXCTextWhiteColor, + TextSize = 12 }; itemView.AddChidren(roomName); } @@ -496,28 +518,12 @@ //upBtn.MouseUpEventHandler += Up; //stopBtn.MouseUpEventHandler += Stop; //downBtn.MouseUpEventHandler += Down; - //SeekBar.ProgressChanged += SeekBar_ProgressChange; - //collectionBtn.MouseUpEventHandler += Collection; - //moreBtn.MouseUpEventHandler += More; - //roomBtn.MouseUpEventHandler += BackToRoomHandler; - //roomName.MouseUpEventHandler += BackToRoomHandler; + collectionBtn.MouseUpEventHandler += Collection; } #endregion - #region 鈼� 鎺у埗___________________________ - - /// <summary> - /// 婊戞潯绉诲姩鍙戦�佸懡浠� - /// </summary> - /// <param name="sender">Sender.</param> - /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param> - private void SeekBar_ProgressChange(object sender, int mouseEventArgs) - { - //seekBarTitle.Text = $"{SeekBar.Progress}%"; - //(device.CommonDevice as ZigBee.Device.Rollershade).WcdGoToTiltValue(SeekBar.Progress); - } - + #region 鈼� 鎺у埗__________________________ /// <summary> /// 涓娿�佸紑 @@ -705,11 +711,36 @@ curtainRollSeekBar.Gravity = Gravity.CenterHorizontal; curtainRollSeekBar.Progress = (device.CommonDevice 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); }; + + curtainRollSeekBar.OnStartTrackingTouchEvent += (sender, e) => + { + OnProgressButtonMove(curtainRollSeekBar.Progress); + ProgressBtn.Visible = true; + }; + + curtainRollSeekBar.OnStopTrackingTouchEvent += (sender, e) => + { + ProgressBtn.Visible = false; + }; + + curtainRollSeekBar.OnProgressChangedEvent += (send2, e2) => + { + + OnProgressButtonMove(e2); + + //鍒ゆ柇鏄惁300ms灞忚斀 + //if (curtainRollSeekBar.IsProgressChangeDelay()) return; + + //(device.CommonDevice as Rollershade).WcdGoToTiltValue(curtainRollSeekBar.Progress); + }; + + InitProgressBtn(layout); } else { @@ -717,16 +748,100 @@ curtainSeekBar.Width = Application.GetRealWidth(570); curtainSeekBar.Height = Application.GetRealHeight(513); curtainSeekBar.Gravity = Gravity.CenterHorizontal; + curtainSeekBar.IsProgressTextShow = false; + curtainSeekBar.Progress = (device.CommonDevice as Rollershade).WcdCurrentPositionLiftPercentage; layout.AddChidren(curtainSeekBar); curtainSeekBar.OnStopTrackingTouchEvent += (sender, e) => { - (device.CommonDevice as Rollershade).WcdGoToTiltValue(curtainRollSeekBar.Progress); + (device.CommonDevice as Rollershade).WcdGoToTiltValue(curtainSeekBar.Progress); }; + + curtainSeekBar.OnStartTrackingTouchEvent += (sender, e) => + { + OnProgressButtonMoveForCurtain(curtainSeekBar.Progress); + ProgressBtn.Visible = true; + }; + + curtainSeekBar.OnStopTrackingTouchEvent += (sender, e) => + { + ProgressBtn.Visible = false; + }; + + curtainSeekBar.OnProgressChangedEvent += (send2, e2) => + { + + OnProgressButtonMoveForCurtain(e2); + + //鍒ゆ柇鏄惁300ms灞忚斀 + //if (curtainRollSeekBar.IsProgressChangeDelay()) return; + + //(device.CommonDevice as Rollershade).WcdGoToTiltValue(curtainRollSeekBar.Progress); + }; + InitProgressBtnForCurtain(layout); } } + /// <summary> + /// 娣诲姞杩涘害鎸夐挳 + /// </summary> + private void InitProgressBtn(FrameLayout layout) + { + ProgressBtnY = curtainRollSeekBar.Y - Application.GetMinReal(204); + 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); + } + /// <summary> + /// OnProgressButtonMove + /// </summary> + private void OnProgressButtonMove(int mProgress) + { + ProgressBtn.Y = ProgressBtnY + curtainRollSeekBar.NowProgressY; + ProgressBtn.Text = mProgress + "%"; + } + + + /// <summary> + /// 娣诲姞杩涘害鎸夐挳 + /// </summary> + private void InitProgressBtnForCurtain(FrameLayout layout) + { + ProgressBtnX = curtainSeekBar.X - Application.GetMinReal(20); + ProgressBtn = new Button() + { + X = ProgressBtnX, + Y = curtainSeekBar.Y + curtainSeekBar.Height / 2 - Application.GetMinReal(180), + Width = Application.GetMinReal(135), + Height = Application.GetMinReal(104), + UnSelectedImagePath = "Item/ProgressBubbles.png", + Visible = false, + TextSize = 14, + IsBold = true, + TextColor = ZigbeeColor.Current.GXCTextWhiteColor + }; + layout.AddChidren(ProgressBtn); + } + + /// <summary> + /// OnProgressButtonMove + /// </summary> + private void OnProgressButtonMoveForCurtain(int mProgress) + { + ProgressBtn.X = ProgressBtnX + curtainSeekBar.NowProgressX- Application.GetMinReal(5); + ProgressBtn.Text = mProgress + "%"; + } #endregion @@ -739,15 +854,14 @@ /// <param name="e">E.</param> private void Collection(object sender, MouseEventArgs e) { - //collection if (collectionBtn.IsSelected) { - Shared.Common.Room.Lists[0].DeleteDevice(device.FileName); + Common.Room.CurrentRoom.GetLoveRoom().DeleteDevice(device.FileName); collectionBtn.IsSelected = false; } else { - Shared.Common.Room.Lists[0].AddDevice(device.FileName); + Common.Room.CurrentRoom.GetLoveRoom().AddDevice(device.FileName); collectionBtn.IsSelected = true; } } -- Gitblit v1.8.0