From 66a9965c44ecc32a6696abca876ab9d1cd091584 Mon Sep 17 00:00:00 2001 From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local> Date: 星期五, 28 二月 2020 15:25:13 +0800 Subject: [PATCH] 2020.2.28 --- ZigbeeApp/Shared/Phone/Device/Light/DimmableLightControl.cs | 137 ++++++++++++++++++++++----------------------- 1 files changed, 67 insertions(+), 70 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 dc7d547..0695856 --- a/ZigbeeApp/Shared/Phone/Device/Light/DimmableLightControl.cs +++ b/ZigbeeApp/Shared/Phone/Device/Light/DimmableLightControl.cs @@ -13,7 +13,7 @@ /// <summary> /// The action. /// </summary> - public Action action; + public Action<DeviceUI, Common.Room> action; ///// <summary> ///// The top view. ///// </summary> @@ -38,7 +38,7 @@ /// 鏀惰棌鎸夐挳 /// </summary> private Button collectionBtn; - + /// <summary> /// 寮�鍏� /// </summary> @@ -47,7 +47,7 @@ /// 婊戞潯 /// </summary> private WaveSeekBar levelSeekBar; - + private Button StatuBtn; /// <summary> @@ -139,7 +139,6 @@ { dimmableLight = deviceUI.CommonDevice as DimmableLight; dimmableLight.DeviceStatusReport = common.DeviceStatusReport; - //璁板綍銆佹洿鏂扮姸鎬� if (dimmableLight.DeviceStatusReport.AttriBute == null || dimmableLight.DeviceStatusReport.AttriBute.Count == 0) { return; @@ -151,16 +150,13 @@ 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; } //浜害 @@ -181,11 +177,10 @@ dimmableLight.LastDateTime = DateTime.Now; levelSeekBar.Progress = (int)(dimmableLight.Level*1.0/MaxLevel*100); StatuBtn.Text = switchBtn.IsSelected ? $"{Language.StringByID(R.MyInternationalizationString.CurrentLightLevel)} { device.GetDeviceStatu()}" : $"{Language.StringByID(R.MyInternationalizationString.Current)} {Language.StringByID(R.MyInternationalizationString.Shut)}"; - break; } } - + } } catch (Exception ex) @@ -196,7 +191,7 @@ } else if (typeTag == "OnlineStatusChange") { - + } } @@ -211,8 +206,8 @@ { ZbGateway.StatusList.Remove(this); UserView.HomePage.Instance.ScrollEnabled = true; - //action(); - //action = null; + action(device, room); + action = null; if (IsDrawerLockMode) { CommonPage.Instance.IsDrawerLockMode = false; @@ -314,9 +309,9 @@ 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); }; } @@ -376,7 +371,7 @@ Width = Application.GetRealWidth(500), Height = Application.GetRealHeight(60), Gravity = Gravity.CenterHorizontal, - Text = device.CommonDevice.DeviceEpointName, + Text = Common.LocalDevice.Current.GetDeviceEpointName(device.CommonDevice), TextColor = ZigbeeColor.Current.GXCTextBlackColor, TextSize = 15, IsBold=true @@ -405,7 +400,7 @@ WavePadding = Application.GetRealWidth(8), MaxValue=100, Progress = (int)(dimmableLight.Level*1.0/MaxLevel*100), - WaveColor = ZigbeeColor.Current.GXCWaveSeekBarColor, + CornerRadius= Application.GetRealHeight(58) }; @@ -414,38 +409,38 @@ 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; - }; - - levelSeekBar.OnProgressChangedEvent += (send2, e2) => + 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) => { - OnProgressButtonMove(e2); - - //鍒ゆ柇鏄惁300ms灞忚斀 - if (levelSeekBar.IsProgressChangeDelay()) return; - - 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() @@ -501,31 +496,34 @@ itemView.AddChidren(roomName); } - /// <summary> - /// OnProgressButtonMove - /// </summary> - private void OnProgressButtonMove(int mProgress) - { - ProgressBtn.Y = ProgressBtnY + levelSeekBar.NowProgressY; - ProgressBtn.Text = mProgress + "%"; - } - - /// <summary> - /// 娣诲姞杩涘害鎸夐挳 - /// </summary> + /// <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); + { + 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 @@ -557,13 +555,13 @@ { 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); } } @@ -576,8 +574,7 @@ /// </summary> private void InitCollection() { - var dev = Shared.Common.Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName); - if (dev == null) + if (Common.Room.CurrentRoom.IsCollectInRoom(device.FileName) == false) { collectionBtn.IsSelected = false; } -- Gitblit v1.8.0