From 159ec8ae413683e1ce134ec204d1c0b4d175baec Mon Sep 17 00:00:00 2001 From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local> Date: 星期四, 14 十一月 2019 15:55:32 +0800 Subject: [PATCH] 2019.11.14 --- ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs | 177 +++++++++++++++++++++++++++++++++-------------------------- 1 files changed, 99 insertions(+), 78 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs b/ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs index 63e9498..0a8ec50 100644 --- a/ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs +++ b/ZigbeeApp/Shared/Phone/Device/AC/ACControl.cs @@ -72,10 +72,6 @@ /// </summary> private Button currentModeBtn; /// <summary> - /// 褰撳墠娓╁害 - /// </summary> - private Button currentTemperatureBtn; - /// <summary> /// 娣诲姞娓╁害 /// </summary> private Button addTemperatureBtn; @@ -112,6 +108,11 @@ /// 浼犺繃鏉ョ殑ac /// </summary> private ZigBee.Device.AC ac; + /// <summary> + /// mArcScaleSeekBar + /// </summary> + private ArcScaleSeekBar mArcScaleSeekBar = new ArcScaleSeekBar { }; + #endregion #region 鈼� 鎺ュ彛___________________________ @@ -174,7 +175,7 @@ ac.currentCoolingSetpoint = curTemp; if (ac.currentSystemMode == 3 || ac.currentSystemMode == 8) { - currentTemperatureBtn.Text = $"{ac.currentCoolingSetpoint} 鈩�"; + mArcScaleSeekBar.Progress = ac.currentCoolingSetpoint; } ac.LastDateTime = DateTime.Now; @@ -184,7 +185,7 @@ ac.currentHeatingSetpoint = curTemp; if (ac.currentSystemMode == 4) { - currentTemperatureBtn.Text = $"{ac.currentHeatingSetpoint} 鈩�"; + mArcScaleSeekBar.Progress = ac.currentHeatingSetpoint; } ac.LastDateTime = DateTime.Now; break; @@ -193,7 +194,7 @@ ac.currentAutoSetpoint = curTemp; if (ac.currentSystemMode == 1) { - currentTemperatureBtn.Text = $"{ac.currentAutoSetpoint} 鈩�"; + mArcScaleSeekBar.Progress = ac.currentAutoSetpoint; } ac.LastDateTime = DateTime.Now; break; @@ -210,8 +211,9 @@ modeBtn.SelectedImagePath = ACControlBase.GetModeSelectedImagePathByModeId(ac.currentSystemMode); modeBtn.UnSelectedImagePath = ACControlBase.GetModeUnSelectedImagePathByModeId(ac.currentSystemMode); currentModeBtn.Text = ACControlBase.GetModeNameByModeId(ac.currentSystemMode); - currentTemperatureBtn.Text = $"{ACControlBase.GetCurrentModeTemperature(ac)} 鈩�"; + mArcScaleSeekBar.Progress = ACControlBase.GetCurrentModeTemperature(ac); + fanModeBtn.IsSelected = false; FanSwingModeBtn.IsSelected = false; } @@ -222,8 +224,8 @@ modeBtn.SelectedImagePath = ACControlBase.GetModeSelectedImagePathByModeId(ac.currentSystemMode); modeBtn.UnSelectedImagePath = ACControlBase.GetModeUnSelectedImagePathByModeId(ac.currentSystemMode); currentModeBtn.Text = ACControlBase.GetModeNameByModeId(ac.currentSystemMode); - currentTemperatureBtn.Text = $"{ACControlBase.GetCurrentModeTemperature(ac)} 鈩�"; + mArcScaleSeekBar.Progress = ACControlBase.GetCurrentModeTemperature(ac); fanModeBtn.IsSelected = true; FanSwingModeBtn.IsSelected = true; } @@ -377,14 +379,26 @@ //鍙戦�佽鍙栫姸鎬佸懡浠� UserView.UserHomeView.ReadStatus(ac, () => { - ac.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch); - ac.ReadLocalTemperature(); - ac.ReadCoolingSetpoint(); - ac.ReadHeatingSetpoint(); - ac.ReadAutoSetpoint(); - ac.ReadFanMode(); - ac.ReadSystemMode(); - ac.ReadSystemFansSwingMode(); + new System.Threading.Thread(() => + { + System.Threading.Thread.Sleep(100); + ac.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch); + System.Threading.Thread.Sleep(100); + ac.ReadLocalTemperature(); + System.Threading.Thread.Sleep(100); + ac.ReadCoolingSetpoint(); + System.Threading.Thread.Sleep(100); + ac.ReadHeatingSetpoint(); + System.Threading.Thread.Sleep(100); + ac.ReadAutoSetpoint(); + System.Threading.Thread.Sleep(100); + ac.ReadFanMode(); + System.Threading.Thread.Sleep(100); + ac.ReadSystemMode(); + System.Threading.Thread.Sleep(100); + ac.ReadSystemFansSwingMode(); + }) + { IsBackground = true }.Start(); }); } else @@ -392,14 +406,26 @@ //闃叉鐭椂闂村唴澶氭璇诲彇璁惧鐘舵�� if ((DateTime.Now - ac.LastDateTime).TotalSeconds > CommonPage.ReadDeviceStatuSpan) { - ac.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch); - ac.ReadLocalTemperature(); - ac.ReadCoolingSetpoint(); - ac.ReadHeatingSetpoint(); - ac.ReadAutoSetpoint(); - ac.ReadFanMode(); - ac.ReadSystemMode(); - ac.ReadSystemFansSwingMode(); + new System.Threading.Thread(() => + { + System.Threading.Thread.Sleep(100); + ac.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch); + System.Threading.Thread.Sleep(100); + ac.ReadLocalTemperature(); + System.Threading.Thread.Sleep(100); + ac.ReadCoolingSetpoint(); + System.Threading.Thread.Sleep(100); + ac.ReadHeatingSetpoint(); + System.Threading.Thread.Sleep(100); + ac.ReadAutoSetpoint(); + System.Threading.Thread.Sleep(100); + ac.ReadFanMode(); + System.Threading.Thread.Sleep(100); + ac.ReadSystemMode(); + System.Threading.Thread.Sleep(100); + ac.ReadSystemFansSwingMode(); + }) + { IsBackground = true }.Start(); } } @@ -435,15 +461,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 { @@ -516,72 +533,71 @@ }; itemView.AddChidren(indoorTemperatureBtn); - - var controlBG = new FrameLayout() + mArcScaleSeekBar = new ArcScaleSeekBar { Y = Application.GetRealHeight(412), - Height = Application.GetMinRealAverage(547), - Width = Application.GetMinRealAverage(671), + Width = Application.GetRealWidth(671), + Height = Application.GetRealHeight(671), Gravity = Gravity.CenterHorizontal, - BackgroundImagePath = "AC/Group.png" + MinValue=ACControlBase.Temperature_Low, + MaxValue=ACControlBase.Temperature_High, + Progress=ACControlBase.GetCurrentModeTemperature(ac) }; - itemView.AddChidren(controlBG); - - var controlBG2 = new Button() + itemView.AddChidren(mArcScaleSeekBar); + mArcScaleSeekBar.OnStopTrackingTouchEvent += (sender, e) => { - Y = Application.GetRealHeight(873), - Height = Application.GetMinRealAverage(121), - Width = Application.GetMinRealAverage(351), - UnSelectedImagePath = "AC/Path.png", - Gravity = Gravity.CenterHorizontal + //cool //dry + if (ac.currentSystemMode == 3 || ac.currentSystemMode == 8) + { + ac.currentCoolingSetpoint = e; + ac.SetCoolingTemperatureAsync(ac.currentCoolingSetpoint * 100); + } + //heat + else if (ac.currentSystemMode == 4) + { + ac.currentHeatingSetpoint = e; + ac.SetHeatingTemperatureAsync(ac.currentHeatingSetpoint * 100); + } + //auto + else if (ac.currentSystemMode == 1) + { + ac.currentAutoSetpoint = e; + ac.SetAutoTemperatureAsync(ac.currentAutoSetpoint * 100); + } }; - itemView.AddChidren(controlBG2); + //褰撳墠妯″紡 currentModeBtn = new Button() { - Y = Application.GetRealHeight(187), + Y = Application.GetRealHeight(599), Height = Application.GetRealHeight(80), Width = Application.GetRealWidth(200), TextColor = ZigbeeColor.Current.GXCTextBlackColor, Gravity = Gravity.CenterHorizontal, Text = ACControlBase.GetModeNameByModeId(ac.currentSystemMode) }; - controlBG.AddChidren(currentModeBtn); + itemView.AddChidren(currentModeBtn); //闄嶄綆娓╁害 reduceTemperatureBtn = new Button() { - X = Application.GetRealWidth(112), - Y = Application.GetRealHeight(268), + X = Application.GetRealWidth(268), + Y = Application.GetRealHeight(680), Width = Application.GetMinRealAverage(80), Height = Application.GetMinRealAverage(80), UnSelectedImagePath = "AC/Reduce.png" }; - controlBG.AddChidren(reduceTemperatureBtn); - - //娓╁害 - currentTemperatureBtn = new Button() - { - //X = Application.GetRealWidth(239), - Y = Application.GetRealHeight(248), - Width = Application.GetRealWidth(180), - Height = Application.GetRealHeight(100), - TextColor = ZigbeeColor.Current.GXCTextBlackColor, - TextSize = 15, - Text = $"{ACControlBase.GetCurrentModeTemperature(ac)} 掳C", - Gravity = Gravity.CenterHorizontal - }; - controlBG.AddChidren(currentTemperatureBtn); + itemView.AddChidren(reduceTemperatureBtn); //娣诲姞娓╁害 addTemperatureBtn = new Button() { - X = Application.GetRealWidth(472), - Y = Application.GetRealHeight(268), + X = Application.GetRealWidth(628), + Y = Application.GetRealHeight(680), Width = Application.GetMinRealAverage(80), Height = Application.GetMinRealAverage(80), UnSelectedImagePath = "AC/Add.png" }; - controlBG.AddChidren(addTemperatureBtn); + itemView.AddChidren(addTemperatureBtn); //鎵 FanSwingModeBtn = new Button() @@ -1075,7 +1091,7 @@ modeBtn.UnSelectedImagePath = ACControlBase.GetModeUnSelectedImagePathByMode(acMode); currentModeBtn.Text = ACControlBase.GetModeNameByMode(acMode); ac.currentSystemMode = (int)acMode; - currentTemperatureBtn.Text = $"{ACControlBase.GetCurrentModeTemperature(ac)} 掳C"; + mArcScaleSeekBar.Progress = ACControlBase.GetCurrentModeTemperature(ac); ac.SetSystemModeAsync(acMode); @@ -1325,7 +1341,8 @@ } ac.currentCoolingSetpoint += 1; ac.SetCoolingTemperatureAsync(ac.currentCoolingSetpoint * 100); - currentTemperatureBtn.Text = $"{ac.currentCoolingSetpoint} 掳C"; + //currentTemperatureBtn.Text = $"{ac.currentCoolingSetpoint} 掳C"; + mArcScaleSeekBar.Progress = ac.currentCoolingSetpoint; } //heat else if (ac.currentSystemMode == 4) @@ -1336,7 +1353,8 @@ } ac.currentHeatingSetpoint += 1; ac.SetHeatingTemperatureAsync(ac.currentHeatingSetpoint * 100); - currentTemperatureBtn.Text = $"{ac.currentHeatingSetpoint} 掳C"; + //currentTemperatureBtn.Text = $"{ac.currentHeatingSetpoint} 掳C"; + mArcScaleSeekBar.Progress = ac.currentHeatingSetpoint; } //auto else if (ac.currentSystemMode == 1) @@ -1347,9 +1365,9 @@ } ac.currentAutoSetpoint += 1; ac.SetAutoTemperatureAsync(ac.currentAutoSetpoint * 100); - currentTemperatureBtn.Text = $"{ac.currentAutoSetpoint} 掳C"; + //currentTemperatureBtn.Text = $"{ac.currentAutoSetpoint} 掳C"; + mArcScaleSeekBar.Progress = ac.currentAutoSetpoint; } - } @@ -1379,7 +1397,8 @@ ac.currentCoolingSetpoint -= 1; ac.SetCoolingTemperatureAsync(ac.currentCoolingSetpoint * 100); - currentTemperatureBtn.Text = $"{ac.currentCoolingSetpoint} 掳C"; + //currentTemperatureBtn.Text = $"{ac.currentCoolingSetpoint} 掳C"; + mArcScaleSeekBar.Progress = ac.currentCoolingSetpoint; } //heat else if (ac.currentSystemMode == 4) @@ -1391,7 +1410,8 @@ ac.currentHeatingSetpoint -= 1; ac.SetHeatingTemperatureAsync(ac.currentHeatingSetpoint * 100); - currentTemperatureBtn.Text = $"{ac.currentHeatingSetpoint} 掳C"; + //currentTemperatureBtn.Text = $"{ac.currentHeatingSetpoint} 掳C"; + mArcScaleSeekBar.Progress = ac.currentHeatingSetpoint; } //auto else if (ac.currentSystemMode == 1) @@ -1403,7 +1423,8 @@ ac.currentAutoSetpoint -= 1; ac.SetAutoTemperatureAsync(ac.currentAutoSetpoint * 100); - currentTemperatureBtn.Text = $"{ac.currentAutoSetpoint} 掳C"; + //currentTemperatureBtn.Text = $"{ac.currentAutoSetpoint} 掳C"; + mArcScaleSeekBar.Progress = ac.currentAutoSetpoint; } } -- Gitblit v1.8.0