From eb9cf55fc8568cb2d4b4bfac9deb617ce766a7a5 Mon Sep 17 00:00:00 2001 From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local> Date: 星期五, 20 十二月 2019 14:58:37 +0800 Subject: [PATCH] 2019.12.30 --- ZigbeeApp/Shared/Phone/Device/Light/DimmableLightControl.cs | 49 ++++++++++++++++++++++++------------------------- 1 files changed, 24 insertions(+), 25 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 02e5698..94c1dc7 --- 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,11 @@ /// MaxLevel /// </summary> private const int MaxLevel = 254; + + /// <summary> + /// IsDrawerLockMode + /// </summary> + public bool IsDrawerLockMode; #endregion #region 鈼� 鎺ュ彛__________________________ @@ -120,10 +126,10 @@ } if (deviceUI.CommonDevice.Type == DeviceType.DimmableLight) { - if ((common as DimmableLight).DeviceStatusReport.CluterID == 6) + if (common.DeviceStatusReport.CluterID == 6) { dimmableLight = deviceUI.CommonDevice as DimmableLight; - dimmableLight.DeviceStatusReport = (common as DimmableLight).DeviceStatusReport; + dimmableLight.DeviceStatusReport = common.DeviceStatusReport; //璁板綍銆佹洿鏂扮姸鎬� if (dimmableLight.DeviceStatusReport.AttriBute == null || dimmableLight.DeviceStatusReport.AttriBute.Count == 0) { @@ -136,20 +142,22 @@ { 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; } //浜害 - if ((common as ZigBee.Device.DimmableLight).DeviceStatusReport.CluterID == 8) + if (common.DeviceStatusReport.CluterID == 8) { dimmableLight = deviceUI.CommonDevice as ZigBee.Device.DimmableLight; - dimmableLight.DeviceStatusReport = (common as ZigBee.Device.DimmableLight).DeviceStatusReport; + dimmableLight.DeviceStatusReport = common.DeviceStatusReport; var attriButeList = dimmableLight.DeviceStatusReport.AttriBute; if (attriButeList == null || attriButeList.Count == 0) { @@ -191,8 +199,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 +216,7 @@ /// </summary> public DimmableLightControl() { + UserView.HomePage.Instance.ScrollEnabled = false; BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor; ZbGateway.StatusList.Add(this); } @@ -236,9 +249,7 @@ //鍙戦�佽鍙栫姸鎬佸懡浠� UserView.UserHomeView.ReadStatus(dimmableLight, () => { - dimmableLight.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch); - dimmableLight.ReadOnOffStatus(); - dimmableLight.ReadLevel(); + ReadDeviceAttributeLogic.Instance.SendDimmableLightStatuComand(device.CommonDevice); }); } else @@ -246,9 +257,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 +278,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 +377,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); @@ -395,7 +394,7 @@ }; itemView.AddChidren(levelSeekBar); - if (dimmableLight.OnOffStatus==1) + if (dimmableLight.OnOffStatus == 1) { levelSeekBar.IsClickable = true; levelSeekBar.WaveColor = ZigbeeColor.Current.GXCWaveSeekBarColor; @@ -408,7 +407,7 @@ levelSeekBar.OnProgressChangedEvent += (send2, e2) => { - dimmableLight.SetLevel((int)(levelSeekBar.Progress*MaxLevel/100.0)); + dimmableLight.SetLevel((int)(levelSeekBar.Progress * MaxLevel / 100.0)); }; switchBtn = new Button() -- Gitblit v1.8.0