From 4296d04029fb5dc41f0ab781c5cf6c60b2cc9670 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期五, 04 八月 2023 11:37:20 +0800
Subject: [PATCH] 三相空开控件优化

---
 HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchP3SubloopEnergyPage.cs |  104 ++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 93 insertions(+), 11 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchP3SubloopEnergyPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchP3SubloopEnergyPage.cs
index dcc70c0..0fce218 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchP3SubloopEnergyPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchP3SubloopEnergyPage.cs
@@ -14,6 +14,12 @@
     {
         static AirSwitchP3SubloopEnergyPage bodyView;
 
+        Button btnRighta;
+
+        Button btnRightb;
+
+        Button btnRightc;
+
         /// <summary>
         /// 鏇茬嚎鍥炬暟鎹畇tring
         /// </summary>
@@ -45,9 +51,9 @@
         /// <summary>
         /// 
         /// </summary>
-        public void LoadPage()
+        public void LoadPage(int titleId)
         {
-            new TopViewDiv(bodyView, Language.StringByID(StringId.EnergyMonitoring)).LoadTopView(0xFFF7F7F7);
+            new TopViewDiv(bodyView, Language.StringByID(titleId)).LoadTopView(0xFFF7F7F7);
             bodyView.BackgroundColor = 0xFFF5F7FA;
 
             var contentView = new VerticalScrolViewLayout()
@@ -85,7 +91,7 @@
             };
             contentView.AddChidren(viewa);
 
-            Button btnRighta = new Button()
+            btnRighta = new Button()
             {
                 X = Application.GetRealWidth(201),
                 Gravity = Gravity.CenterVertical,
@@ -126,7 +132,7 @@
             };
             contentView.AddChidren(viewb);
 
-            Button btnRightb = new Button()
+            btnRightb = new Button()
             {
                 X = Application.GetRealWidth(201),
                 Gravity = Gravity.CenterVertical,
@@ -167,7 +173,7 @@
             };
             contentView.AddChidren(viewc);
 
-            Button btnRightc = new Button()
+            btnRightc = new Button()
             {
                 X = Application.GetRealWidth(201),
                 Gravity = Gravity.CenterVertical,
@@ -221,6 +227,7 @@
                 BackgroundColor = 0x1F5C62FE,
                 BorderColor = CSS_Color.MainColor,
                 BorderWidth = 2,
+                Radius = 1,
             };
             showDataTypeView.AddChidren(btnShowHistroyData_Day);
             btnShowHistroyData_Day.SetCornerWithSameRadius((uint)Application.GetRealHeight(6), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerBottomLeft);
@@ -240,8 +247,11 @@
                 IsSelected = false,
                 BorderWidth = 1,
                 BorderColor = CSS_Color.PromptingColor1,
+                Radius = 1,
             };
             showDataTypeView.AddChidren(btnShowHistroyData_Month);
+            btnShowHistroyData_Month.BorderWidth = 1;
+            btnShowHistroyData_Month.BorderColor = CSS_Color.PromptingColor1;
 
             var btnShowHistroyData_Year = new Button()
             {
@@ -257,8 +267,11 @@
                 IsSelected = false,
                 BorderWidth = 1,
                 BorderColor = CSS_Color.PromptingColor1,
+                Radius = 1,
             };
             showDataTypeView.AddChidren(btnShowHistroyData_Year);
+            btnShowHistroyData_Year.BorderWidth = 1;
+            btnShowHistroyData_Year.BorderColor = CSS_Color.PromptingColor1;
 
             var btnShowHistroyData_Total = new Button()
             {
@@ -274,6 +287,7 @@
                 IsSelected = false,
                 BorderWidth = 1,
                 BorderColor = CSS_Color.PromptingColor1,
+                Radius = 1,
             };
             showDataTypeView.AddChidren(btnShowHistroyData_Total);
             btnShowHistroyData_Total.SetCornerWithSameRadius((uint)Application.GetRealHeight(6), HDLUtils.RectCornerBottomRight | HDLUtils.RectCornerTopRight);
@@ -311,6 +325,10 @@
                 btnShowHistroyData_Day.BackgroundColor = 0x00000000;
                 btnShowHistroyData_Day.SelectedBackgroundColor = 0x00000000;
 
+#if __IOS__
+                btnShowHistroyData_Day.SetCornerWithSameRadius((uint)Application.GetRealHeight(6), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerBottomLeft);
+                btnShowHistroyData_Total.SetCornerWithSameRadius((uint)Application.GetRealHeight(6), HDLUtils.RectCornerBottomRight | HDLUtils.RectCornerTopRight);
+#endif
 
             };
 
@@ -344,6 +362,10 @@
                 btnShowHistroyData_Total.BorderColor = CSS_Color.PromptingColor1;
                 btnShowHistroyData_Total.BackgroundColor = 0x00000000;
                 btnShowHistroyData_Total.SelectedBackgroundColor = 0x00000000;
+#if __IOS__
+                btnShowHistroyData_Day.SetCornerWithSameRadius((uint)Application.GetRealHeight(6), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerBottomLeft);
+                btnShowHistroyData_Total.SetCornerWithSameRadius((uint)Application.GetRealHeight(6), HDLUtils.RectCornerBottomRight | HDLUtils.RectCornerTopRight);
+#endif
 
                 curQueryType = "hour";
                 brokenLine.YvalueText = "";
@@ -379,6 +401,10 @@
                 btnShowHistroyData_Total.BorderColor = CSS_Color.PromptingColor1;
                 btnShowHistroyData_Total.BackgroundColor = 0x00000000;
                 btnShowHistroyData_Total.SelectedBackgroundColor = 0x00000000;
+#if __IOS__
+                btnShowHistroyData_Day.SetCornerWithSameRadius((uint)Application.GetRealHeight(6), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerBottomLeft);
+                btnShowHistroyData_Total.SetCornerWithSameRadius((uint)Application.GetRealHeight(6), HDLUtils.RectCornerBottomRight | HDLUtils.RectCornerTopRight);
+#endif
 
                 curQueryType = "month";
                 brokenLine.YvalueText = "";
@@ -415,6 +441,10 @@
                 btnShowHistroyData_Total.BorderColor = CSS_Color.PromptingColor1;
                 btnShowHistroyData_Total.BackgroundColor = 0x00000000;
                 btnShowHistroyData_Total.SelectedBackgroundColor = 0x00000000;
+#if __IOS__
+                btnShowHistroyData_Day.SetCornerWithSameRadius((uint)Application.GetRealHeight(6), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerBottomLeft);
+                btnShowHistroyData_Total.SetCornerWithSameRadius((uint)Application.GetRealHeight(6), HDLUtils.RectCornerBottomRight | HDLUtils.RectCornerTopRight);
+#endif
 
 
                 curQueryType = "year_month";
@@ -448,7 +478,7 @@
 
             var btnTip = new Button()
             {
-                Y = Application.GetRealHeight(289),
+                Y = Application.GetRealWidth(289),
                 Height = Application.GetRealHeight(41),
                 Width = Application.GetRealWidth(300),
                 TextAlignment = TextAlignment.Center,
@@ -540,11 +570,14 @@
                 historyDataView.Height = Application.GetRealHeight(184);
             };
 
-
-
-
-
             #endregion
+
+
+            new System.Threading.Thread(() =>
+            {
+                DriverLayer.Control.Ins.SendReadCommand(device);
+            })
+            { IsBackground = true }.Start();
 
 
 
@@ -656,7 +689,7 @@
                         brokenLine.xTitle = Language.StringByID(StringId.Date);
                     }
 
-                    var opString = brokenLine.InitOption(50, curQueryType == "year_month");
+                    var opString = brokenLine.InitOption(100, curQueryType == "year_month");
                     Application.RunOnMainThread(() =>
                     {
                         myEchartsView_Line.ShowWithOption(opString);
@@ -677,6 +710,55 @@
             { IsBackground = true }.Start();
         }
 
+        /// <summary>
+        /// 
+        /// </summary>
+        public static void UpdataStatus(Function updataTemp)
+        {
+            Application.RunOnMainThread(() =>
+            {
+                try
+                {
+                    if (bodyView != null)
+                    {
+                        double power = 0.00;
+                        double voltage = 0.00;
+                        double current = 0.00;
+                        switch (bodyView.key)
+                        {
+                            case FunctionAttributeKey.ElectricityA:
+                                double.TryParse(updataTemp.GetAttrState(FunctionAttributeKey.PowerA), out power);
+                                double.TryParse(updataTemp.GetAttrState(FunctionAttributeKey.VoltageA),out voltage);
+                                double.TryParse(updataTemp.GetAttrState(FunctionAttributeKey.CurrentA),out current);
+                                break;
+                            case FunctionAttributeKey.ElectricityB:
+                                double.TryParse(updataTemp.GetAttrState(FunctionAttributeKey.PowerB), out power);
+                                double.TryParse(updataTemp.GetAttrState(FunctionAttributeKey.VoltageB), out voltage);
+                                double.TryParse(updataTemp.GetAttrState(FunctionAttributeKey.CurrentB), out current);
+                                break;
+                            case FunctionAttributeKey.ElectricityC:
+                                double.TryParse(updataTemp.GetAttrState(FunctionAttributeKey.PowerC), out power);
+                                double.TryParse(updataTemp.GetAttrState(FunctionAttributeKey.VoltageC), out voltage);
+                                double.TryParse(updataTemp.GetAttrState(FunctionAttributeKey.CurrentC), out current);
+                                break;
+                        }
+                        bodyView.btnRighta.Text = voltage.ToString("F2") + "V";
+                        bodyView.btnRightb.Text = current.ToString("F2") + "A";
+                        bodyView.btnRightc.Text = power.ToString("F2") + "W";
+                    }
+                }
+                catch (Exception ex)
+                {
+                    MainPage.Log($"鏇存柊涓夌浉瀛愰」寮傚父:{ex.Message}");
+                }
+            });
+        }
+
+        public override void RemoveFromParent()
+        {
+            base.RemoveFromParent();
+            bodyView = null;
+        }
 
     }
 }
\ No newline at end of file

--
Gitblit v1.8.0