From 950c0732a016ad3154981e983e71696055db2003 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期二, 08 六月 2021 16:49:12 +0800
Subject: [PATCH] 5月功能迭代版本

---
 HDL_ON/UI/UI2/FuntionControlView/Energy/EnergyMainPage.cs |   80 +++++++++++++++++++--------------------
 1 files changed, 39 insertions(+), 41 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/Energy/EnergyMainPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Energy/EnergyMainPage.cs
index f6365e3..a728cbc 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Energy/EnergyMainPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Energy/EnergyMainPage.cs
@@ -29,13 +29,13 @@
         /// </summary>
         TextButton btnTotalValue;
         /// <summary>
+        /// 鎬诲姛鑰�-楗煎浘
+        /// </summary>
+        MyEchartsViewOn myEchartsView_Pie;
+        /// <summary>
         /// 鍘嗗彶鏁版嵁鍖哄煙
         /// </summary>
         FrameLayout diagramView;
-        /// <summary>
-        /// 鏇茬嚎鍥�
-        /// </summary>
-        MyEchartsViewOn myLineEchartsView;
         /// <summary>
         /// 鏇茬嚎鍥炬暟鎹畇tring
         /// </summary>
@@ -64,7 +64,7 @@
         /// <summary>
         /// 鍘嗗彶鏁版嵁鍥捐〃
         /// </summary>
-        MyEchartsViewOn myEchartsView;
+        MyEchartsViewOn myEchartsView_Line;
         /// <summary>
         /// 鏇茬嚎鍥炬槸鍚﹀睍寮�
         /// </summary>
@@ -105,7 +105,7 @@
             generalTableView = new FrameLayout()
             {
                 Gravity = Gravity.CenterHorizontal,
-                Y = Application.GetRealHeight(16),
+                Y = Application.GetRealWidth(16),
                 Width = Application.GetRealWidth(343),
                 Height = Application.GetRealWidth(148),//419//148
                 Radius = (uint)Application.GetRealWidth(5),
@@ -154,8 +154,6 @@
             };
             generalTableView.AddChidren(btnRealTimeData);
 
-            UpdataValue();
-
 
             var echartsView = new FrameLayout()
             {
@@ -165,29 +163,22 @@
                 //Y = Application.GetRealWidth(16),
             };
             generalTableView.AddChidren(echartsView);
-            myEchartsView = new MyEchartsViewOn()
+            myEchartsView_Pie = new MyEchartsViewOn()
             {
                 Width = Application.GetRealWidth(118),
                 Height = Application.GetRealWidth(118),
             };
+            echartsView.AddChidren(myEchartsView_Pie);
 
-            echartsView.AddChidren(myEchartsView);
             Dictionary<string, string> list = new Dictionary<string, string>();
-
             foreach(var ene in energyList)
             {
                 double tt = 0;
                 double.TryParse(ene.GetAttrState(FunctionAttributeKey.TotalElectricity), out tt);
                 tt *= 100;//涔樹互100锛屽皬浜�1鏃犳硶鍔犺浇echart
-
                 list.Add(ene.name, tt.ToString());
             }
-
-            var echartsPie = new EchartsOption_Pie();
-            var echartRootJson = echartsPie.InitDateJson(list);
-            //var echartRootJsonString = Newtonsoft.Json.JsonConvert.SerializeObject(echartRootJson);
-            myEchartsView.ShowWithOption(echartRootJson);
-
+            myEchartsView_Pie.ShowWithOption(new EchartsOption_Pie().InitDateJson(list));
 
             btnDrodDown = new Button()
             {
@@ -204,6 +195,7 @@
                 showDiagramView();
             };
 
+            UpdataValue();
             #endregion
 
 
@@ -218,7 +210,11 @@
             {
                 EnergyRow(energy, energyListView, index);
                 index++;
-                Control.Ins.SendReadCommand(energy);
+                new System.Threading.Thread(() =>
+                {
+                    Control.Ins.SendReadCommand(energy);
+                })
+                { IsBackground = true }.Start();
             }
 
 
@@ -231,13 +227,13 @@
         {
             if (isUnfoldOrStow)//灞曞紑
             {
-                generalTableView.Height = Application.GetRealHeight(419);
+                generalTableView.Height = Application.GetRealWidth(419);
                 btnDrodDown.Y = Application.GetRealWidth(389);
                 btnDrodDown.IsSelected = true;
             }
             else
             {
-                generalTableView.Height = Application.GetRealHeight(148);
+                generalTableView.Height = Application.GetRealWidth(148);
                 btnDrodDown.Y = Application.GetRealWidth(118);
                 btnDrodDown.IsSelected = false;
             }
@@ -256,10 +252,10 @@
 
             diagramView = new FrameLayout()
             {
-                Y = Application.GetRealHeight(136),
+                Y = Application.GetRealWidth(136),
                 Gravity = Gravity.CenterHorizontal,
                 Width = Application.GetRealWidth(343),
-                Height = Application.GetRealWidth(241),
+                Height = Application.GetRealWidth(281),
                 BackgroundColor = CSS_Color.MainBackgroundColor,
                 Radius = (uint)Application.GetRealWidth(12),
                 BorderColor = 0x00000000,
@@ -361,19 +357,17 @@
             var historyDataView = new FrameLayout()
             {
                 Gravity = Gravity.CenterHorizontal,
-                Y = Application.GetRealHeight(52),
-                //Width = Application.GetRealWidth(343 - 32),
-                Height = Application.GetRealHeight(178),
+                Y = Application.GetRealWidth(52),
+                Height = Application.GetRealWidth(190),
             };
             diagramView.AddChidren(historyDataView);
 
-            myEchartsView = new MyEchartsViewOn() {
-                Y = Application.GetRealHeight(10),
-                Height = Application.GetRealHeight(150),
+            myEchartsView_Line = new MyEchartsViewOn()
+            {
+                Y = Application.GetRealWidth(10),
+                Height = Application.GetRealWidth(180),
             };
-
-            historyDataView.AddChidren(myEchartsView);
-
+            historyDataView.AddChidren(myEchartsView_Line);
         }
 
         /// <summary>
@@ -392,7 +386,7 @@
 
                 Application.RunOnMainThread(() =>
                 {
-                    myEchartsView.ShowWithOption(opString);
+                    myEchartsView_Line.ShowWithOption(opString);
                 });
 
                 return;
@@ -435,11 +429,6 @@
                                 sr.attributes.Add(new FunctionAttributes() { key = "ydata" });
                             }
                             sr.SetAttrState("ydata", brokenLine.InitYdataText(sr.name, revertData, sr.GetAttrState("color")) + ",");
-                            //if (sr.GetAttribute("ydata") == null)
-                            //{
-                            //    sr.attributes.Add(new FunctionAttributes() { key = "ydata" });
-                            //}
-                            //sr.SetAttrState("ydata", brokenLine.InitYdataText(sr.name, revertData, sr.GetAttrState("color")) + ",");
                         }
                     }
                     brokenLine.yTitle = Language.StringByID(StringId.EnergyConsumption) + "(kW)";
@@ -452,7 +441,7 @@
 
                     Application.RunOnMainThread(() =>
                     {
-                        myEchartsView.ShowWithOption(opString);
+                        myEchartsView_Line.ShowWithOption(opString);
                     });
                 }
                 catch (Exception ex)
@@ -515,8 +504,6 @@
             row.Y = btnLine.Bottom;
             view.AddChidren(row);
             listButton_value.Add(row.btnValue);
-
-            Control.Ins.SendReadCommand(energy);
         }
 
 
@@ -560,6 +547,7 @@
         {
             double totalValue = 0;
             double realtimeValue = 0;
+            Dictionary<string, string> list = new Dictionary<string, string>();//楗煎浘鏁版嵁
             foreach (var ene in bodyView.energyList)
             {
                 double power = 0;
@@ -569,6 +557,13 @@
                 int realTimePower = 0;
                 int.TryParse(ene.GetAttrState(FunctionAttributeKey.Power), out realTimePower);
                 realtimeValue += realTimePower;
+
+                #region 楗煎浘鏁版嵁
+                double tt = 0;
+                double.TryParse(ene.GetAttrState(FunctionAttributeKey.TotalElectricity), out tt);
+                tt *= 100;//涔樹互100锛屽皬浜�1鏃犳硶鍔犺浇echart
+                list.Add(ene.name, tt.ToString());
+                #endregion
             }
             bodyView.btnTotalValue.Text = totalValue.ToString();
             realtimeValue /= 1000;
@@ -576,6 +571,9 @@
             ///鍔ㄦ�佽幏鍙栨枃鏈搴�
             bodyView.btnTotalValue.Width = bodyView.btnTotalValue.GetTextWidth() + Application.GetRealWidth(5);
             bodyView.btnTotalValueUint.X = bodyView.btnTotalValue.Right;
+            //鍒锋柊楗煎浘
+            bodyView.myEchartsView_Pie.ShowWithOption(new EchartsOption_Pie().InitDateJson(list));
+
         }
     }
 

--
Gitblit v1.8.0