From 2d5cd35af7437ad4015d38594d8c721dc6166b11 Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期二, 29 八月 2023 09:22:38 +0800
Subject: [PATCH] Merge branch 'wjc' of http://59.41.255.150:6688/r/~wxr/OnPro into wjc

---
 HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchP3EnergyPage.cs |  694 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 694 insertions(+), 0 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchP3EnergyPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchP3EnergyPage.cs
new file mode 100644
index 0000000..3f900c4
--- /dev/null
+++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchP3EnergyPage.cs
@@ -0,0 +1,694 @@
+锘縰sing System;
+using System.Collections.Generic;
+using HDL_ON.DAL.Server;
+using HDL_ON.DriverLayer;
+using HDL_ON.Entity;
+using HDL_ON.UI.CSS;
+using Shared;
+namespace HDL_ON.UI
+{
+    /// <summary>
+    /// 涓夌浉绌哄紑鑳芥簮鐣岄潰
+    /// </summary>
+    public class AirSwitchP3EnergyPage : FrameLayout
+    {
+        static AirSwitchP3EnergyPage bodyView;
+
+        /// <summary>
+        /// 鏇茬嚎鍥炬暟鎹畇tring
+        /// </summary>
+        EchartsOption_BrokenLine brokenLine;
+
+        /// <summary>
+        /// 鏌ヨ鏉′欢
+        /// hour銆亀eek銆乵onth
+        /// </summary>
+        string curQueryType = "hour";
+
+
+        /// <summary>
+        /// 鍘嗗彶鏁版嵁鍥捐〃
+        /// </summary>
+        MyEchartsViewOn myEchartsView_Line;
+
+        //5C62FE
+
+        Function device;
+        /// <summary>
+        /// 涓婚〉
+        /// </summary>
+        public AirSwitchP3EnergyPage(Function function)
+        {
+            bodyView = this;
+            device = function;
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public void LoadPage()
+        {
+            new TopViewDiv(bodyView, Language.StringByID(StringId.EnergyMonitoring)).LoadTopView(0xFFF7F7F7);
+            bodyView.BackgroundColor = 0xFFF5F7FA;
+
+            var contentView = new VerticalScrolViewLayout()
+            {
+                Y = Application.GetRealHeight(64),
+                Height = Application.GetRealHeight(667-64),
+                BackgroundColor = 0xFFF5F7FA,
+                ScrollEnabled = false,
+            };
+            bodyView.AddChidren(contentView);
+
+            contentView.AddChidren(new Button()
+            {
+                Height = Application.GetRealHeight(12),
+            });
+
+
+            brokenLine = new EchartsOption_BrokenLine();
+
+            #region 閫夋嫨鏁版嵁鏃ユ湡鑼冨洿
+            var showDataTypeView = new FrameLayout()
+            {
+                X = Application.GetRealWidth(143),
+                Y = Application.GetRealHeight(12),
+                Width = Application.GetRealWidth(216),
+                Height = Application.GetRealHeight(27),
+                //BackgroundImagePath = "FunctionIcon/EnvironmentalScience/SensorHistoryBg1.png",
+            };
+            contentView.AddChidren(showDataTypeView);
+
+            var btnShowHistroyData_Day = new Button()
+            {
+                Width = Application.GetRealWidth(54),
+                Height = Application.GetRealHeight(27),
+                TextAlignment = TextAlignment.Center,
+                TextColor = CSS_Color.PromptingColor1,
+                SelectedTextColor = CSS_Color.MainColor,
+                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+                IsSelected = true,
+                TextID = StringId.day,
+                SelectedBackgroundColor = 0x1F5C62FE,
+                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);
+
+          
+            var btnShowHistroyData_Month = new Button()
+            {
+                X = Application.GetRealWidth(54),
+                Width = Application.GetRealWidth(54),
+                TextAlignment = TextAlignment.Center,
+                TextColor = CSS_Color.PromptingColor1,
+                SelectedTextColor = CSS_Color.MainColor,
+                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+                TextID = StringId.month,
+                SelectedBackgroundColor = 0x1F5C62FE,
+                BackgroundColor = 0x00000000,
+                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()
+            {
+                X = Application.GetRealWidth(54 * 2),
+                Width = Application.GetRealWidth(54),
+                TextAlignment = TextAlignment.Center,
+                TextColor = CSS_Color.PromptingColor1,
+                SelectedTextColor = CSS_Color.MainColor,
+                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+                TextID = StringId.Years,
+                SelectedBackgroundColor = 0x1F5C62FE,
+                BackgroundColor = 0x00000000,
+                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()
+            {
+                X = Application.GetRealWidth(54 * 3),
+                Width = Application.GetRealWidth(54),
+                TextAlignment = TextAlignment.Center,
+                TextColor = CSS_Color.PromptingColor1,
+                SelectedTextColor = CSS_Color.MainColor,
+                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+                TextID = StringId.Total,
+                SelectedBackgroundColor = 0x1F5C62FE,
+                BackgroundColor = 0x00000000,
+                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);
+
+
+            btnShowHistroyData_Total.MouseUpEventHandler = (sender, e) =>
+            {
+                if(curQueryType == "total")
+                {
+                    return;
+                }
+                (sender as Button).SelectedBackgroundColor = 0x1F5C62FE;
+                (sender as Button).BackgroundColor = 0x1F5C62FE;
+                (sender as Button).BorderColor = CSS_Color.MainColor;
+                (sender as Button).BorderWidth = 2;
+                (sender as Button).IsSelected = true;
+
+                btnShowHistroyData_Month.IsSelected = false;
+                btnShowHistroyData_Month.BorderWidth = 1;
+                btnShowHistroyData_Month.BorderColor = CSS_Color.PromptingColor1;
+                btnShowHistroyData_Month.BackgroundColor = 0x00000000;
+                btnShowHistroyData_Month.SelectedBackgroundColor = 0x00000000;
+
+                btnShowHistroyData_Year.IsSelected = false;
+                btnShowHistroyData_Year.BorderWidth = 1;
+                btnShowHistroyData_Year.BorderColor = CSS_Color.PromptingColor1;
+                btnShowHistroyData_Year.BackgroundColor = 0x00000000;
+                btnShowHistroyData_Year.SelectedBackgroundColor = 0x00000000;
+
+                btnShowHistroyData_Day.IsSelected = false;
+                btnShowHistroyData_Day.BorderWidth = 1;
+                btnShowHistroyData_Day.BorderColor = CSS_Color.PromptingColor1;
+                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
+            };
+
+            btnShowHistroyData_Day.MouseUpEventHandler = (sender, e) =>
+            {
+                if(curQueryType == "hour")
+                {
+                    return;
+                }
+                (sender as Button).SelectedBackgroundColor = 0x1F5C62FE;
+                (sender as Button).BackgroundColor = 0x1F5C62FE;
+                (sender as Button).BorderColor = CSS_Color.MainColor;
+                (sender as Button).BorderWidth = 2;
+                (sender as Button).IsSelected = true;
+
+                btnShowHistroyData_Month.IsSelected = false;
+                btnShowHistroyData_Month.BorderWidth = 1;
+                btnShowHistroyData_Month.BorderColor = CSS_Color.PromptingColor1;
+                btnShowHistroyData_Month.BackgroundColor = 0x00000000;
+                btnShowHistroyData_Month.SelectedBackgroundColor = 0x00000000;
+
+                btnShowHistroyData_Year.IsSelected = false;
+                btnShowHistroyData_Year.BorderWidth = 1;
+                btnShowHistroyData_Year.BorderColor = CSS_Color.PromptingColor1;
+                btnShowHistroyData_Year.BackgroundColor = 0x00000000;
+                btnShowHistroyData_Year.SelectedBackgroundColor = 0x00000000;
+
+                btnShowHistroyData_Total.IsSelected = false;
+                btnShowHistroyData_Total.BorderWidth = 1;
+                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 = "";
+                LoadMothed_GetHistoryData();
+            };
+
+            btnShowHistroyData_Month.MouseUpEventHandler = (sender, e) =>
+            {
+                if(curQueryType == "month")
+                {
+                    return;
+                }
+                (sender as Button).SelectedBackgroundColor = 0x1F5C62FE;
+                (sender as Button).BackgroundColor = 0x1F5C62FE;
+                (sender as Button).BorderColor = CSS_Color.MainColor;
+                (sender as Button).BorderWidth = 2;
+                (sender as Button).IsSelected = true;
+
+                btnShowHistroyData_Day.IsSelected = false;
+                btnShowHistroyData_Day.BorderWidth = 1;
+                btnShowHistroyData_Day.BorderColor = CSS_Color.PromptingColor1;
+                btnShowHistroyData_Day.BackgroundColor = 0x00000000;
+                btnShowHistroyData_Day.SelectedBackgroundColor = 0x00000000;
+
+                btnShowHistroyData_Year.IsSelected = false;
+                btnShowHistroyData_Year.BorderWidth = 1;
+                btnShowHistroyData_Year.BorderColor = CSS_Color.PromptingColor1;
+                btnShowHistroyData_Year.BackgroundColor = 0x00000000;
+                btnShowHistroyData_Year.SelectedBackgroundColor = 0x00000000;
+
+                btnShowHistroyData_Total.IsSelected = false;
+                btnShowHistroyData_Total.BorderWidth = 1;
+                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 = "";
+                LoadMothed_GetHistoryData();
+            };
+
+            btnShowHistroyData_Year.MouseUpEventHandler = (sender, e) =>
+            {
+                if(curQueryType == "year_month")
+                {
+                    return;
+                }
+                (sender as Button).SelectedBackgroundColor = 0x1F5C62FE;
+                (sender as Button).BackgroundColor = 0x1F5C62FE;
+                (sender as Button).BorderColor = CSS_Color.MainColor;
+                (sender as Button).BorderWidth = 2;
+                (sender as Button).IsSelected = true;
+
+                btnShowHistroyData_Month.IsSelected = false;
+                btnShowHistroyData_Month.BorderWidth = 1;
+                btnShowHistroyData_Month.BorderColor = CSS_Color.PromptingColor1;
+                btnShowHistroyData_Month.BackgroundColor = 0x00000000;
+                btnShowHistroyData_Month.SelectedBackgroundColor = 0x00000000;
+
+                btnShowHistroyData_Day.IsSelected = false;
+                btnShowHistroyData_Day.BorderWidth = 1;
+                btnShowHistroyData_Day.BorderColor = CSS_Color.PromptingColor1;
+                btnShowHistroyData_Day.BackgroundColor = 0x00000000;
+                btnShowHistroyData_Day.SelectedBackgroundColor = 0x00000000;
+
+                btnShowHistroyData_Total.IsSelected = false;
+                btnShowHistroyData_Total.BorderWidth = 1;
+                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";
+                brokenLine.YvalueText = "";
+                LoadMothed_GetHistoryData();
+            };
+
+            #endregion
+
+            contentView.AddChidren(new Button()
+            {
+                Height = Application.GetRealHeight(12),
+            });
+
+            var historyDataView = new FrameLayout()
+            {
+                Gravity = Gravity.CenterHorizontal,
+                Width = Application.GetRealWidth(343),
+                Height = Application.GetRealWidth(330),
+                Radius = (uint)Application.GetRealWidth(16),
+                BackgroundColor = CSS_Color.MainBackgroundColor,
+            };
+            contentView.AddChidren(historyDataView);
+
+            myEchartsView_Line = new MyEchartsViewOn()
+            {
+                Y = Application.GetRealWidth(10),
+                Height = Application.GetRealWidth(280),
+            };
+            historyDataView.AddChidren(myEchartsView_Line);
+
+            var btnTip = new Button()
+            {
+                Y = Application.GetRealWidth(289),
+                Height = Application.GetRealHeight(41),
+                Width = Application.GetRealWidth(300),
+                TextAlignment = TextAlignment.Center,
+                Gravity = Gravity.CenterHorizontal,
+                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+                TextColor = CSS_Color.FirstLevelTitleColor,
+                TextID = StringId.AirSwitchP3HistroyTip1,
+            };
+            historyDataView.AddChidren(btnTip);
+
+            LoadMothed_GetHistoryData();
+
+            #region A
+            contentView.AddChidren(new Button()
+            {
+                Height = Application.GetRealHeight(12),
+            });
+
+            var viewa = new FrameLayout()
+            {
+                Gravity  = Gravity.CenterHorizontal,
+                Width = Application.GetRealWidth(343),
+                Height = Application.GetRealHeight(52),
+                BackgroundColor = CSS_Color.MainBackgroundColor,
+                Radius = (uint)Application.GetRealWidth(12),
+            };
+            contentView.AddChidren(viewa);
+
+            Button btnRighta = new Button()
+            {
+                X = Application.GetRealWidth(321),
+                Gravity = Gravity.CenterVertical,
+                Width = Application.GetMinRealAverage(16),
+                Height = Application.GetMinRealAverage(16),
+                UnSelectedImagePath = "Public/Right.png",
+            };
+            viewa.AddChidren(btnRighta);
+
+            Button btnTitlea = new Button()
+            {
+                X = Application.GetRealWidth(16),
+                TextAlignment = TextAlignment.CenterLeft,
+                TextSize = CSS_FontSize.TextFontSize,
+                TextColor= 0xFF000000,
+                Width = Application.GetRealWidth(300),
+                TextID = StringId.RealTimeElectricityConsumptionDataOfPhaseA
+            };
+            viewa.AddChidren(btnTitlea);
+            #endregion
+
+
+            #region B
+            contentView.AddChidren(new Button()
+            {
+                Height = Application.GetRealHeight(12),
+            });
+
+            var viewb = new FrameLayout()
+            {
+                Gravity  = Gravity.CenterHorizontal,
+                Width = Application.GetRealWidth(343),
+                Height = Application.GetRealHeight(52),
+                BackgroundColor = CSS_Color.MainBackgroundColor,
+                Radius = (uint)Application.GetRealWidth(12),
+            };
+            contentView.AddChidren(viewb);
+
+            Button btnRightb = new Button()
+            {
+                X = Application.GetRealWidth(321),
+                Gravity = Gravity.CenterVertical,
+                Width = Application.GetMinRealAverage(16),
+                Height = Application.GetMinRealAverage(16),
+                UnSelectedImagePath = "Public/Right.png",
+            };
+            viewb.AddChidren(btnRightb);
+
+            Button btnTitleb = new Button()
+            {
+                X = Application.GetRealWidth(16),
+                Width = Application.GetRealWidth(300),
+                TextAlignment = TextAlignment.CenterLeft,
+                TextSize = CSS_FontSize.TextFontSize,
+                TextColor = 0xFF000000,
+                TextID = StringId.RealTimeElectricityConsumptionDataOfPhaseB,
+            };
+            viewb.AddChidren(btnTitleb);
+            #endregion
+
+
+            #region C
+            contentView.AddChidren(new Button()
+            {
+                Height = Application.GetRealHeight(12),
+            });
+
+            var viewc = new FrameLayout()
+            {
+                Gravity  = Gravity.CenterHorizontal,
+                Width = Application.GetRealWidth(343),
+                Height = Application.GetRealHeight(52),
+                BackgroundColor = CSS_Color.MainBackgroundColor,
+                Radius = (uint)Application.GetRealWidth(12),
+            };
+            contentView.AddChidren(viewc);
+
+            Button btnRightc = new Button()
+            {
+                X = Application.GetRealWidth(321),
+                Gravity = Gravity.CenterVertical,
+                Width = Application.GetMinRealAverage(16),
+                Height = Application.GetMinRealAverage(16),
+                UnSelectedImagePath = "Public/Right.png",
+            };
+            viewc.AddChidren(btnRightc);
+
+            Button btnTitlec = new Button()
+            {
+                X = Application.GetRealWidth(16),
+                Width = Application.GetRealWidth(300),
+                TextAlignment = TextAlignment.CenterLeft,
+                TextSize = CSS_FontSize.TextFontSize,
+                TextColor = 0xFF000000,
+                TextID = StringId.RealTimeElectricityConsumptionDataOfPhaseC,
+            };
+            viewc.AddChidren(btnTitlec);
+            #endregion
+
+
+            btnTitlea.MouseUpEventHandler = (sender, e) => {
+                var skipView = new AirSwitchP3SubloopEnergyPage(device,FunctionAttributeKey.ElectricityA);
+                MainPage.BasePageView.AddChidren(skipView);
+                skipView.LoadPage(StringId.RealTimeElectricityConsumptionDataOfPhaseA);
+                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+            };
+
+            btnTitleb.MouseUpEventHandler = (sender, e) => {
+                var skipView = new AirSwitchP3SubloopEnergyPage(device, FunctionAttributeKey.ElectricityB);
+                MainPage.BasePageView.AddChidren(skipView);
+                skipView.LoadPage(StringId.RealTimeElectricityConsumptionDataOfPhaseB);
+                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+            };
+
+            btnTitlec.MouseUpEventHandler = (sender, e) => {
+                var skipView = new AirSwitchP3SubloopEnergyPage(device, FunctionAttributeKey.ElectricityC);
+                MainPage.BasePageView.AddChidren(skipView);
+                skipView.LoadPage(StringId.RealTimeElectricityConsumptionDataOfPhaseC);
+                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+            };
+
+
+
+            #region 鎬荤敤鐢甸噺
+            var totalElectricityView = new FrameLayout()
+            {
+                Gravity = Gravity.CenterHorizontal,
+                Width = Application.GetRealWidth(343),
+                Height = Application.GetRealWidth(183),
+                Radius = (uint)Application.GetRealWidth(16),
+                BackgroundColor = CSS_Color.MainBackgroundColor,
+            };
+            //historyDataView.AddChidren(totalElectricityView);
+
+            var btnTotalElectricity = new Button()
+            {
+                Width = Application.GetRealWidth(300),
+                Height = Application.GetRealHeight(55),
+                X = Application.GetRealWidth(14),
+                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+                TextColor = 0xFF030D1C,
+                TextAlignment = TextAlignment.CenterLeft,
+                TextID = StringId.TotalPowerAndUnit,
+            };
+            totalElectricityView.AddChidren(btnTotalElectricity);
+
+
+            double totalNumber = 0.00;
+            double.TryParse(device.GetAttrState(FunctionAttributeKey.TotalElectricity), out totalNumber);
+            var btnTotalNumber = new Button()
+            {
+                Y = Application.GetRealHeight(27),
+                Gravity = Gravity.CenterHorizontal,
+                Height = Application.GetRealHeight(167),
+                TextSize = 49,
+                TextColor = 0xFF030D1C,
+                TextAlignment = TextAlignment.Center,
+                Text = totalNumber.ToString("F2"),
+            };
+            totalElectricityView.AddChidren(btnTotalNumber);
+
+            btnShowHistroyData_Day.MouseUpEventHandler += (sender, e) => {
+                totalElectricityView.RemoveFromParent();
+                historyDataView.AddChidren(myEchartsView_Line);
+                //viewa.Visible = true;
+                //viewb.Visible = true;
+                //viewc.Visible = true;
+                btnTip.TextID = StringId.AirSwitchP3HistroyTip1;
+                historyDataView.Height = Application.GetRealWidth(330);
+            };
+            btnShowHistroyData_Month.MouseUpEventHandler += (sender, e) => {
+                totalElectricityView.RemoveFromParent();
+                historyDataView.AddChidren(myEchartsView_Line);
+                //viewa.Visible = true;
+                //viewb.Visible = true;
+                //viewc.Visible = true;
+                btnTip.TextID = StringId.AirSwitchP3HistroyTip2;
+                historyDataView.Height = Application.GetRealWidth(330);
+            };
+            btnShowHistroyData_Year.MouseUpEventHandler += (sender, e) => {
+                totalElectricityView.RemoveFromParent();
+                historyDataView.AddChidren(myEchartsView_Line);
+                //viewa.Visible = false;
+                //viewb.Visible = false;
+                //viewc.Visible = false;
+                btnTip.TextID = StringId.AirSwitchP3HistroyTip3;
+                historyDataView.Height = Application.GetRealWidth(330);
+            };
+            btnShowHistroyData_Total.MouseUpEventHandler += (sender, e) => {
+                myEchartsView_Line.RemoveFromParent();
+                historyDataView.AddChidren(totalElectricityView);
+                //viewa.Visible = false;
+                //viewb.Visible = false;
+                //viewc.Visible = false;
+                historyDataView.Height = Application.GetRealHeight(184);
+            };
+
+
+
+
+
+            #endregion
+
+
+
+        }
+
+
+
+
+        /// <summary>
+        /// 璇诲彇鍘嗗彶鏁版嵁
+        /// </summary>
+        void LoadMothed_GetHistoryData()
+        {
+
+            var loadPage = new Loading()
+            {
+                LodingBackgroundColor = 0x88888888,
+            };
+            bodyView.AddChidren(loadPage);
+
+            new System.Threading.Thread(() =>
+            {
+                try
+                {
+                    Application.RunOnMainThread(() =>
+                    {
+                        loadPage.Start(Language.StringByID(StringId.PleaseWait));
+                    });
+
+                    var sensorType = device.spk.Split(".")[1];
+                    var revertObj = new HttpServerRequest().GetSensorHistory(curQueryType, device.deviceId, FunctionAttributeKey.TotalElectricity);
+                    if (revertObj != null)
+                    {
+                        if (revertObj.Code == StateCode.SUCCESS)
+                        {
+                            var revertData = Newtonsoft.Json.JsonConvert.DeserializeObject<List<EnvironmentalSensorHistor>>(revertObj.Data.ToString());
+#if DEBUG
+                            if (revertData == null || revertData.Count == 0) {
+                                List<string> vs = new List<string>() {
+                                    "1","2","3","4",
+                                    "5","6","7","8",
+                                    "9","10","11","12",
+                                    //"13","14","15","16",
+                                    //"17","18","19","20",
+                                    //"21","22","23","24",
+                                };
+                                    brokenLine.InitXdataText(vs);
+                                revertData = new List<EnvironmentalSensorHistor>()
+                                {
+                                    new EnvironmentalSensorHistor{ fieldValue = "100"},
+                                    new EnvironmentalSensorHistor{ fieldValue = "200"},
+                                    new EnvironmentalSensorHistor{ fieldValue = "300"},
+                                    new EnvironmentalSensorHistor{ fieldValue = "400"},
+                                    new EnvironmentalSensorHistor{ fieldValue = "500"},
+                                    new EnvironmentalSensorHistor{ fieldValue = "400"},
+                                    new EnvironmentalSensorHistor{ fieldValue = "100"},
+                                    new EnvironmentalSensorHistor{ fieldValue = "200"},
+                                    new EnvironmentalSensorHistor{ fieldValue = "300"},
+                                    new EnvironmentalSensorHistor{ fieldValue = "400"},
+                                    new EnvironmentalSensorHistor{ fieldValue = "500"},
+                                    new EnvironmentalSensorHistor{ fieldValue = "400"},
+                                };
+                                if (device.GetAttribute("ydata") == null)
+                                {
+                                    device.attributes.Add(new FunctionAttributes() { key = "ydata" });
+                                }
+                                device.SetAttrState("ydata", brokenLine.InitYdataText2(device.name, revertData, "#5C62FE", curQueryType == "year_month") + ", ");
+
+                        }
+                        else
+#endif
+                            {
+                                List<string> vs = new List<string>();
+                                if (brokenLine.YvalueText == "")
+                                {
+                                    foreach (var data in revertData)
+                                    {
+                                        vs.Add(data.fieldName);
+                                    }
+                                    brokenLine.InitXdataText(vs);
+                                }
+                                if (device.GetAttribute("ydata") == null)
+                                {
+                                    device.attributes.Add(new FunctionAttributes() { key = "ydata" });
+                                }
+                                device.SetAttrState("ydata", brokenLine.InitYdataText2(device.name, revertData, "#5C62FE", curQueryType == "year_month") + ", ");
+                            }
+                        }
+                    }
+                    brokenLine.yTitle = Language.StringByID(StringId.Uint) + "(KW路h)";
+                    brokenLine.xTitle = Language.StringByID(StringId.timeMode);
+                    if (curQueryType != "hour")
+                    {
+                        brokenLine.xTitle = Language.StringByID(StringId.Date);
+                    }
+
+                    var opString = brokenLine.InitOption(100, curQueryType == "year_month");
+                    Application.RunOnMainThread(() =>
+                    {
+                        myEchartsView_Line.ShowWithOption(opString);
+                    });
+                }
+                catch (Exception ex)
+                {
+                    MainPage.Log($"sensor history error : {ex.Message}");
+                }
+                finally
+                {
+                    Application.RunOnMainThread(() =>
+                    {
+                        loadPage.Hide();
+                    });
+                }
+            })
+            { IsBackground = true }.Start();
+        }
+
+
+    }
+}
\ No newline at end of file

--
Gitblit v1.8.0