From 6d73bf6e816570291865674bef8bce8972e4de3f Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期三, 01 十二月 2021 16:32:57 +0800
Subject: [PATCH] 2021-12-01-01
---
HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage.cs | 112 +++++++++++++++++++++++++++++++++++--------------------
1 files changed, 71 insertions(+), 41 deletions(-)
diff --git a/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage.cs b/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage.cs
index 6a70e2c..56c921d 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage.cs
@@ -52,9 +52,13 @@
AC acFunction = new AC();
/// <summary>
- /// app鑷繁鎺у埗鐨勬俯搴︽暟鍊艰褰�
+ /// 鎺у埗鏃堕棿
/// </summary>
- List<string> seltControlTemp = new List<string>();
+ DateTime controlTime = DateTime.MinValue.AddDays(10);
+ /// <summary>
+ /// 鎺у埗娓╁害
+ /// </summary>
+ int temp = 16;
#endregion
@@ -65,6 +69,19 @@
/// </summary>
public override void InitFrameWhiteContent()
{
+
+ var sk = device.GetAttribute(FunctionAttributeKey.SetTemp);
+ if (sk != null)
+ {
+ if (sk.min == 0)
+ {
+ sk.min = 16;
+ }
+ if (sk.max == 0)
+ {
+ sk.max = 32;
+ }
+ }
base.ShowColltionButton = false;
base.SetTitleText(Language.StringByID(StringId.Electric));
@@ -79,7 +96,19 @@
//璇诲彇鐘舵��
new System.Threading.Thread(() =>
{
- Control.Ins.SendReadCommand(device);
+ while (true)
+ {
+ if(controlTime == DateTime.MinValue)
+ {
+
+ }
+ else if (controlTime.AddSeconds(2)<DateTime.Now)
+ {
+ Control.Ins.SendReadCommand(device);
+ controlTime = DateTime.MinValue;
+ }
+ System.Threading.Thread.Sleep(1000);
+ }
})
{ IsBackground = true }.Start();
}
@@ -89,7 +118,7 @@
/// </summary>
private void InitFrameWhiteContent1()
{
-
+ temp = (int)Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp));
arcBar = new DiyArcSeekBar()
{
Gravity = Gravity.CenterHorizontal,
@@ -816,13 +845,14 @@
{
return;
}
- var temp = (int)Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp));
+
if (temp <= device.GetAttribute(FunctionAttributeKey.SetTemp).min)
{
return;
}
- temp--;
- seltControlTemp.Add(temp.ToString());
+ --temp;
+ Console.WriteLine($"temp == {temp}");
+ controlTime = DateTime.Now;
arcBar.Progress = temp;
btnTemp.Text = temp.ToString();
device.SetAttrState(FunctionAttributeKey.SetTemp, temp.ToString());
@@ -836,13 +866,12 @@
{
return;
}
- var temp = (int)Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp));
if (temp >= device.GetAttribute(FunctionAttributeKey.SetTemp).max)
{
return;
}
- temp++;
- seltControlTemp.Add(temp.ToString());
+ ++temp;
+ controlTime = DateTime.Now;
arcBar.Progress = temp;
btnTemp.Text = temp.ToString();
device.SetAttrState(FunctionAttributeKey.SetTemp, temp.ToString());
@@ -938,48 +967,49 @@
{
Application.RunOnMainThread(() =>
{
- btnTemp.Text = Convert.ToDouble( device.GetAttrState(FunctionAttributeKey.SetTemp)).ToString();
- btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.RoomTemp))) + "掳C";
- btnMode.SelectedImagePath = acFunction.GetModeIconPath(device.GetAttrState(FunctionAttributeKey.Mode));
- btnSwing.SelectedImagePath = acFunction.GetSwingIconPath(device.GetAttrState(FunctionAttributeKey.Swing));
- btnWindSpeed.SelectedImagePath = acFunction.GetFanIconPath(device.GetAttrState(FunctionAttributeKey.FanSpeed));
- btnMode.UnSelectedImagePath = acFunction.GetModeIconPath(device.GetAttrState(FunctionAttributeKey.Mode),false);
- btnSwing.UnSelectedImagePath = acFunction.GetSwingIconPath(device.GetAttrState(FunctionAttributeKey.Swing),false);
- btnWindSpeed.UnSelectedImagePath = acFunction.GetFanIconPath(device.GetAttrState(FunctionAttributeKey.FanSpeed),false);
- var updataTemp = Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp)));
-
//app鑷繁鎺у埗鐨勪笉鐢ㄦ洿鏂帮紝浼氶�犳垚璺冲姩
- if (seltControlTemp.Contains(updataTemp.ToString()))
+ if (controlTime.AddSeconds(2) > DateTime.Now)
{
- seltControlTemp.Remove(updataTemp.ToString());
+ return;
}
else
{
- arcBar.Progress = updataTemp;
- }
+ btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.RoomTemp))) + "掳C";
+ btnMode.SelectedImagePath = acFunction.GetModeIconPath(device.GetAttrState(FunctionAttributeKey.Mode));
+ btnSwing.SelectedImagePath = acFunction.GetSwingIconPath(device.GetAttrState(FunctionAttributeKey.Swing));
+ btnWindSpeed.SelectedImagePath = acFunction.GetFanIconPath(device.GetAttrState(FunctionAttributeKey.FanSpeed));
+ btnMode.UnSelectedImagePath = acFunction.GetModeIconPath(device.GetAttrState(FunctionAttributeKey.Mode), false);
+ btnSwing.UnSelectedImagePath = acFunction.GetSwingIconPath(device.GetAttrState(FunctionAttributeKey.Swing), false);
+ btnWindSpeed.UnSelectedImagePath = acFunction.GetFanIconPath(device.GetAttrState(FunctionAttributeKey.FanSpeed), false);
+ temp = Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp)));
- if (device.trait_on_off.curValue.ToString() == "on")
- {
- btnMode.IsSelected = btnSwing.IsSelected = btnWindSpeed.IsSelected = true;
- arcBar.IsOffline = false;
- btnSwitch.IsSelected = true;
- arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIconOn.png";
- if (device.GetAttrState(FunctionAttributeKey.Mode) == "fan")
+
+ arcBar.Progress = temp;
+ btnTemp.Text = temp.ToString() ;
+
+ if (device.trait_on_off.curValue.ToString() == "on")
{
- arcBar.IsClickable = false;
+ btnMode.IsSelected = btnSwing.IsSelected = btnWindSpeed.IsSelected = true;
+ arcBar.IsOffline = false;
+ btnSwitch.IsSelected = true;
+ arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIconOn.png";
+ if (device.GetAttrState(FunctionAttributeKey.Mode) == "fan")
+ {
+ arcBar.IsClickable = false;
+ }
+ else
+ {
+ arcBar.IsClickable = true;
+ }
}
else
{
- arcBar.IsClickable = true;
+ btnMode.IsSelected = btnSwing.IsSelected = btnWindSpeed.IsSelected = false;
+ arcBar.IsOffline = true;
+ btnSwitch.IsSelected = false;
+ arcBar.IsClickable = false;
+ arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIcon.png";
}
- }
- else
- {
- btnMode.IsSelected = btnSwing.IsSelected = btnWindSpeed.IsSelected = false;
- arcBar.IsOffline = true;
- btnSwitch.IsSelected = false;
- arcBar.IsClickable = false;
- arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIcon.png";
}
});
--
Gitblit v1.8.0