| | |
| | | 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 |
| | | |
| | |
| | | //读取状态 |
| | | new System.Threading.Thread(() => |
| | | { |
| | | 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(); |
| | | } |
| | |
| | | /// </summary> |
| | | private void InitFrameWhiteContent1() |
| | | { |
| | | |
| | | temp = (int)Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp)); |
| | | arcBar = new DiyArcSeekBar() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | |
| | | { |
| | | 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()); |
| | |
| | | { |
| | | 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()); |
| | |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnTemp.Text = Convert.ToDouble( device.GetAttrState(FunctionAttributeKey.SetTemp)).ToString(); |
| | | //app自己控制的不用更新,会造成跳动 |
| | | if (controlTime.AddSeconds(2) > DateTime.Now) |
| | | { |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | 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)); |
| | |
| | | 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))); |
| | | temp = Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp))); |
| | | |
| | | //app自己控制的不用更新,会造成跳动 |
| | | if (seltControlTemp.Contains(updataTemp.ToString())) |
| | | { |
| | | seltControlTemp.Remove(updataTemp.ToString()); |
| | | } |
| | | else |
| | | { |
| | | arcBar.Progress = updataTemp; |
| | | } |
| | | |
| | | arcBar.Progress = temp; |
| | | btnTemp.Text = temp.ToString() ; |
| | | |
| | | if (device.trait_on_off.curValue.ToString() == "on") |
| | | { |
| | |
| | | arcBar.IsClickable = false; |
| | | arcBar.ThumbImagePath = "FunctionIcon/AC/DiyThumbIcon.png"; |
| | | } |
| | | } |
| | | |
| | | }); |
| | | } |