From 822861fed1a8732d40d75f15389b0c3d975bf611 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期五, 05 十一月 2021 10:27:44 +0800
Subject: [PATCH] 空调设置温度跳动问题

---
 HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage.cs    |   99 +++++++++++++++++++-------------
 HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs |   12 ++-
 HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPage.cs    |    2 
 .vs/HDL_APP_Project/xs/UserPrefs.xml                              |   23 +++++--
 HDL_ON/DAL/Mqtt/MqttClient.cs                                     |    2 
 HDL_ON/UI/UI1-Login/LoginPage.cs                                  |    2 
 6 files changed, 86 insertions(+), 54 deletions(-)

diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml
index 2ac4a02..85ea5ee 100644
--- a/.vs/HDL_APP_Project/xs/UserPrefs.xml
+++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml
@@ -1,8 +1,13 @@
-锘�<Properties StartupConfiguration="{D998E133-F0DD-4760-BE3C-461632F54DA4}|Default">
+锘�<Properties StartupConfiguration="{09712674-2A38-407B-B1E2-560B2C352F9A}|Default">
   <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget" />
-  <MonoDevelop.Ide.Workbench>
+  <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/DAL/Mqtt/MqttClient.cs">
     <Files>
-      <File FileName="HDL_ON/DAL/Server/HttpUtil.cs" Line="21" Column="85" />
+      <File FileName="HDL_ON/DAL/Server/HttpUtil.cs" Line="8" Column="17" />
+      <File FileName="HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs" />
+      <File FileName="HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPage.cs" />
+      <File FileName="HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage.cs" Line="969" Column="46" />
+      <File FileName="HDL_ON/UI/UI1-Login/LoginPage.cs" Line="235" Column="57" />
+      <File FileName="HDL_ON/DAL/Mqtt/MqttClient.cs" Line="313" Column="69" />
     </Files>
     <Pads>
       <Pad Id="ProjectPad">
@@ -10,10 +15,16 @@
           <Node name="HDL_APP_Project" expanded="True">
             <Node name="HDL_ON" expanded="True">
               <Node name="DAL" expanded="True">
+                <Node name="Mqtt" expanded="True">
+                  <Node name="MqttClient.cs" selected="True" />
+                </Node>
                 <Node name="Server" expanded="True" />
               </Node>
+              <Node name="UI" expanded="True">
+                <Node name="UI1-Login" expanded="True" />
+              </Node>
             </Node>
-            <Node name="HDL-ON_iOS" expanded="True" selected="True" />
+            <Node name="HDL-ON_iOS" expanded="True" />
           </Node>
         </State>
       </Pad>
@@ -25,8 +36,8 @@
     <String>Shared.Droid.TouchID/Shared.Droid.TouchID.csproj</String>
     <String>Shared.IOS/Shared.IOS.csproj</String>
   </DisabledProjects>
-  <MonoDevelop.Ide.Workspace ActiveConfiguration="Release|iPhone" />
-  <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.SelectDevice" />
+  <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
+  <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.364c4b3158493098" />
   <MonoDevelop.Ide.DebuggingService.Breakpoints>
     <BreakpointStore>
       <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/DAL/Server/HttpServerRequest.cs" relfile="HDL_ON/DAL/Server/HttpServerRequest.cs" line="1415" column="1" />
diff --git a/HDL_ON/DAL/Mqtt/MqttClient.cs b/HDL_ON/DAL/Mqtt/MqttClient.cs
index 1974da4..b638339 100644
--- a/HDL_ON/DAL/Mqtt/MqttClient.cs
+++ b/HDL_ON/DAL/Mqtt/MqttClient.cs
@@ -310,7 +310,7 @@
                             try
                             {
                                 var topic = e.ApplicationMessage.Topic;
-                                MainPage.Log($"鏀跺埌mqtt涓婚:{topic}");
+                                //MainPage.Log($"鏀跺埌mqtt涓婚:{topic}");
                                 //涓�绔彛涓婚澶勭悊
                                 if (DB_ResidenceData.Instance.GatewayType == 0 && !DB_ResidenceData.Instance.CheckWhetherGatewayIdIsNull())
                                 {
diff --git a/HDL_ON/UI/UI1-Login/LoginPage.cs b/HDL_ON/UI/UI1-Login/LoginPage.cs
index 911e6d2..bdb35c9 100644
--- a/HDL_ON/UI/UI1-Login/LoginPage.cs
+++ b/HDL_ON/UI/UI1-Login/LoginPage.cs
@@ -225,7 +225,6 @@
                     //etAccount.Text = "13415629083";
                     //etAccount.Text = "13676202754";//宸存灄鏈嶅姟鍣�
                     //etAccount.Text = "13602944661";//kx
-                    etAccount.Text = "551775569@qq.com";//wcf
                     //etAccount.Text = "18666455392";//13375012446//13602944661//tzy 18778381374
                     //etAccount.Text = "15971583093";//楂樿儨
                     //etAccount.Text = "15217626103";//鏄嗘槑閲戣寕椤圭洰
@@ -239,6 +238,7 @@
                     //etAccount.Text = "support5@hdlchina.com.cn";
                     //etAccount.Text = "13375012441";
                     etAccount.Text = "info@smartlife-ks.com";
+                    etAccount.Text = "551775569@qq.com";//wcf
                 }
                 b = !b;
                 etPassword.Text = "123456";
diff --git a/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage.cs b/HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage.cs
index cd87d70..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
 
@@ -92,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();
         }
@@ -102,7 +118,7 @@
         /// </summary>
         private void InitFrameWhiteContent1()
         {
-
+            temp = (int)Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp));
             arcBar = new DiyArcSeekBar()
             {
                 Gravity = Gravity.CenterHorizontal,
@@ -829,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());
@@ -849,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());
@@ -951,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";
                 }
 
             });
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPage.cs
index 3bbabed..9abe53d 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPage.cs
@@ -145,7 +145,7 @@
                 Height = Application.GetRealHeight(50),
                 TextSize = CSS_FontSize.TextFontSize,
                 TextColor = CSS_Color.PromptingColor1,
-                Text = curtainTemp.GetPercent(function).ToString() + "%",
+                Text =  curtainTemp.GetPercent(function).ToString() + "%",
             };
             controlView.AddChidren(btnProgress);
 
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs b/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs
index 25b967f..5554a63 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Curtain/RollingShutterPageBLL.cs
@@ -26,10 +26,14 @@
                     //bodyView.btnCurtainClose.IsSelected = percent == 0;
                     try
                     {
-                        if (!bodyView.onCurtainAnimation)
-                        {
-                            bodyView.CurtainAnimation(Convert.ToInt32(updateTemp.GetAttrState(FunctionAttributeKey.Percent)));
-                        }
+                        var progress = Convert.ToInt32(updateTemp.GetAttrState(FunctionAttributeKey.Percent));
+                        bodyView.curtainSeekBar.Progress = progress;
+                        bodyView.btnProgress.Text =  progress + "%";
+
+                        //if (!bodyView.onCurtainAnimation)
+                        //{
+                        //    bodyView.CurtainAnimation(Convert.ToInt32(updateTemp.GetAttrState(FunctionAttributeKey.Percent)));
+                        //}
                     }
                     catch { }
                 }

--
Gitblit v1.8.0