From fdd5cb921b0783ed81c7c9fb3f8327e3f6905c40 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期二, 01 六月 2021 11:58:06 +0800
Subject: [PATCH] 1

---
 HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPage.cs |   43 ++++++++++++++++++++++++++++++-------------
 1 files changed, 30 insertions(+), 13 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPage.cs b/HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPage.cs
index bbb692a..68f8232 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/FunctionBaseInfoSetPage.cs
@@ -257,13 +257,18 @@
                 };
                 energyView1.AddChidren(btnEnergyText1);
 
+
+                double realTimePower = 0;
+                double.TryParse(function.GetAttrState(FunctionAttributeKey.Power), out realTimePower);
+                realTimePower /= 1000;
+
                 var energyValue1 = new Button()
                 {
                     Width = Application.GetRealWidth(355),
                     TextAlignment = TextAlignment.CenterRight,
                     TextSize = CSS_FontSize.TextFontSize,
                     TextColor = CSS_Color.PromptingColor1,
-                    Text = function.GetAttrState(FunctionAttributeKey.Power) + "kW",
+                    Text = realTimePower + "kW",
                 };
                 energyView1.AddChidren(energyValue1);
 
@@ -296,7 +301,7 @@
                 };
                 energyView2.AddChidren(btnEnergyText2);
 
-                var energyValue2 = new Button()
+                var btnEnergyValue2 = new Button()
                 {
                     Width = Application.GetRealWidth(355),
                     TextAlignment = TextAlignment.CenterRight,
@@ -304,7 +309,7 @@
                     TextColor = CSS_Color.PromptingColor1,
                     Text = "--kW",
                 };
-                energyView2.AddChidren(energyValue2);
+                energyView2.AddChidren(btnEnergyValue2);
 
                 energyView2.AddChidren(
                     new Button()
@@ -316,26 +321,38 @@
                         Height = Application.GetRealHeight(1)
                     });
 
-                new System.Threading.Thread(() => {
-                    var pm = new DAL.Server.HttpServerRequest();
-                    var data = pm.GetLastMonthHistory(function.deviceId,FunctionAttributeKey.TotalElectricity);
-                    if(data!= null)
+                new System.Threading.Thread(() =>
+                {
+                    var pm = new HttpServerRequest();
+                    var data = pm.GetLastMonthHistory(function.deviceId, FunctionAttributeKey.TotalElectricity);
+                    if (data != null)
                     {
-                        if(data.Code == StateCode.SUCCESS)
+                        if (data.Code == StateCode.SUCCESS)
                         {
                             var dataPack = Newtonsoft.Json.JsonConvert.DeserializeObject<JObject>(data.Data.ToString());
-                            if(dataPack!=null)
+                            if (dataPack != null)
                             {
-                                var dataValue = dataPack.GetValue("property").ToString();
-                                if(!string.IsNullOrEmpty(dataValue))
+                                try
                                 {
-                                    btnEnergyText2.Text = dataValue + "kW";
+                                    var dataValue = dataPack.GetValue("monthDiff").ToString();
+                                    if (!string.IsNullOrEmpty(dataValue))
+                                    {
+                                        Application.RunOnMainThread(() =>
+                                        {
+                                            btnEnergyValue2.Text = dataValue + "kW鈥";
+                                        });
+                                    }
+                                }
+                                catch
+                                {
+
                                 }
                             }
                         }
                     }
 
-                }) { IsBackground = true }.Start();
+                })
+                { IsBackground = true }.Start();
 
                 #endregion
             }

--
Gitblit v1.8.0