From 944b87b6bcccb095cd73f13f4410fb20faf48f74 Mon Sep 17 00:00:00 2001 From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local> Date: 星期三, 25 十二月 2019 11:21:06 +0800 Subject: [PATCH] 2019.12.25 --- ZigbeeApp/Shared/Phone/Device/Light/DimmableLightControl.cs | 102 +++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 78 insertions(+), 24 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/Light/DimmableLightControl.cs b/ZigbeeApp/Shared/Phone/Device/Light/DimmableLightControl.cs old mode 100755 new mode 100644 index 5dd0ba7..c8c1092 --- a/ZigbeeApp/Shared/Phone/Device/Light/DimmableLightControl.cs +++ b/ZigbeeApp/Shared/Phone/Device/Light/DimmableLightControl.cs @@ -1,6 +1,7 @@ 锘縰sing System; using Shared.Common; using Shared.Phone.Device.CommonForm; +using Shared.Phone.Device.DeviceLogic; using ZigBee.Device; namespace Shared.Phone.Device.Light @@ -61,6 +62,20 @@ /// MaxLevel /// </summary> private const int MaxLevel = 254; + + /// <summary> + /// IsDrawerLockMode + /// </summary> + public bool IsDrawerLockMode; + /// <summary> + /// ProgressBtn + /// </summary> + Button ProgressBtn; + /// <summary> + /// ProgressBtnY + /// </summary> + int ProgressBtnY; + #endregion #region 鈼� 鎺ュ彛__________________________ @@ -136,11 +151,13 @@ { levelSeekBar.IsClickable = true; levelSeekBar.WaveColor = ZigbeeColor.Current.GXCWaveSeekBarColor; + //levelSeekBar.Progress = 100; } else { levelSeekBar.IsClickable = false; levelSeekBar.WaveColor = ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor; + //levelSeekBar.Progress = 0; } //change color dimmableLight.LastDateTime = DateTime.Now; @@ -191,8 +208,12 @@ { ZbGateway.StatusList.Remove(this); UserView.HomePage.Instance.ScrollEnabled = true; - action(); - action = null; + //action(); + //action = null; + if (IsDrawerLockMode) + { + CommonPage.Instance.IsDrawerLockMode = false; + } base.RemoveFromParent(); } @@ -204,6 +225,7 @@ /// </summary> public DimmableLightControl() { + UserView.HomePage.Instance.ScrollEnabled = false; BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor; ZbGateway.StatusList.Add(this); } @@ -236,9 +258,7 @@ //鍙戦�佽鍙栫姸鎬佸懡浠� UserView.UserHomeView.ReadStatus(dimmableLight, () => { - dimmableLight.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch); - dimmableLight.ReadOnOffStatus(); - dimmableLight.ReadLevel(); + ReadDeviceAttributeLogic.Instance.SendDimmableLightStatuComand(device.CommonDevice); }); } else @@ -246,9 +266,7 @@ //闃叉鐭椂闂村唴澶氭璇诲彇璁惧鐘舵�� if ((DateTime.Now - dimmableLight.LastDateTime).TotalSeconds > CommonPage.ReadDeviceStatuSpan) { - dimmableLight.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch); - dimmableLight.ReadOnOffStatus(); - dimmableLight.ReadLevel(); + ReadDeviceAttributeLogic.Instance.SendDimmableLightStatuComand(device.CommonDevice); } } } @@ -269,16 +287,6 @@ { 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 { @@ -378,7 +386,7 @@ Height = Application.GetRealHeight(60), Gravity = Gravity.CenterHorizontal, TextColor = ZigbeeColor.Current.GXCTextGrayColor, - Text = CommonFormResouce.GetSwitchStatu(device.CommonDevice.IsOnline == 1) + Text = CommonFormResouce.GetSwitchStatu((device.CommonDevice as DimmableLight).OnOffStatus == 1) }; itemView.AddChidren(StatuBtn); @@ -388,14 +396,14 @@ 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 }; itemView.AddChidren(levelSeekBar); - if (dimmableLight.OnOffStatus==1) + if (dimmableLight.OnOffStatus == 1) { levelSeekBar.IsClickable = true; levelSeekBar.WaveColor = ZigbeeColor.Current.GXCWaveSeekBarColor; @@ -406,10 +414,29 @@ levelSeekBar.WaveColor = ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor; } - levelSeekBar.OnProgressChangedEvent += (send2, e2) => + levelSeekBar.OnStartTrackingTouchEvent += (sender, e) => + { + OnProgressButtonMove(levelSeekBar.Progress); + ProgressBtn.Visible = true; + }; + + levelSeekBar.OnStopTrackingTouchEvent += (sender, e) => + { + ProgressBtn.Visible = false; + }; + + 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() { @@ -463,6 +490,33 @@ 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 + }; + layout.AddChidren(ProgressBtn); + } + #endregion #region 鈼� 缁戝畾鎸夐挳_______________________ -- Gitblit v1.8.0