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/AirSwitchP3SubloopEnergyPage.cs | 814 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 814 insertions(+), 0 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchP3SubloopEnergyPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchP3SubloopEnergyPage.cs new file mode 100644 index 0000000..c7b7676 --- /dev/null +++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/AirSwitchP3SubloopEnergyPage.cs @@ -0,0 +1,814 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Net; +using HDL_ON.Common; +using HDL_ON.DAL.Server; +using HDL_ON.DriverLayer; +using HDL_ON.Entity; +using HDL_ON.UI.CSS; +using Newtonsoft.Json; +//using OpenTK; +using Shared; + +namespace HDL_ON.UI +{ + /// <summary> + /// 涓夌浉绌哄紑瀛愮浉鍘嗗彶鏁版嵁鐣岄潰 + /// </summary> + public class AirSwitchP3SubloopEnergyPage : FrameLayout + { + static AirSwitchP3SubloopEnergyPage bodyView; + + Button btnRighta; + + Button btnRightb; + + Button btnRightc; + + /// <summary> + /// 鏇茬嚎鍥炬暟鎹畇tring + /// </summary> + EchartsOption_BrokenLine brokenLine; + /// <summary> + /// 鏌ヨ鏉′欢 + /// hour銆亀eek銆乵onth + /// </summary> + string curQueryType = "hour"; + + /// <summary> + /// 鍘嗗彶鏁版嵁鍥捐〃 + /// </summary> + MyEchartsViewOn myEchartsView_Line; + + Function device; + + string key = ""; + /// <summary> + /// 涓婚〉 + /// </summary> + public AirSwitchP3SubloopEnergyPage(Function function,string searchKey) + { + bodyView = this; + this.key = searchKey; + device = function; + } + + /// <summary> + /// + /// </summary> + public void LoadPage(int titleId) + { + new TopViewDiv(bodyView, Language.StringByID(titleId)).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 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); + + btnRighta = new Button() + { + X = Application.GetRealWidth(201), + Gravity = Gravity.CenterVertical, + Width = Application.GetMinRealAverage(116), + TextAlignment = TextAlignment.CenterRight, + TextColor = 0xFF768194, + TextSize = CSS_FontSize.TextFontSize, + Text = "--- V", + }; + 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.Voltage + }; + 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); + + btnRightb = new Button() + { + X = Application.GetRealWidth(201), + Gravity = Gravity.CenterVertical, + Width = Application.GetMinRealAverage(116), + TextAlignment = TextAlignment.CenterRight, + TextColor = 0xFF768194, + TextSize = CSS_FontSize.TextFontSize, + Text = "--- A", + }; + 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.Current, + }; + 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); + + btnRightc = new Button() + { + X = Application.GetRealWidth(201), + Gravity = Gravity.CenterVertical, + Width = Application.GetMinRealAverage(116), + TextAlignment = TextAlignment.CenterRight, + TextColor = 0xFF768194, + TextSize = CSS_FontSize.TextFontSize, + Text = "--- W", + }; + 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.ActivePower, + }; + viewc.AddChidren(btnTitlec); + #endregion + + contentView.AddChidren(new Button() + { + Height = Application.GetRealHeight(26), + }); + + #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; + } + curQueryType = "total"; + + (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 鎬荤敤鐢甸噺 + 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(key), 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 = true; + //viewb.Visible = true; + //viewc.Visible = true; + 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 + + + if (Control.Ins.GatewayOnline_Local == true) + { + new System.Threading.Thread(() => + { + Control.Ins.SendReadCommand(device); + }) + { IsBackground = true }.Start(); + } + else + { + if (Control.Ins.GatewayOnline_Cloud) + { + new System.Threading.Thread(() => + { + try + { + var deviceResult = ApiUtlis.Ins.HttpRequest.GetDeviceInfo(device.deviceId); + + if (deviceResult != null) + { + if (deviceResult.Code == StateCode.SUCCESS) + { + if (deviceResult.Data != null) + { + var packList = JsonConvert.DeserializeObject<List<Function>>(deviceResult.Data.ToString()); + if (packList != null) + { + if (packList.Count > 0) + { + if (packList[0].isOnline()) + { + Control.Ins.SendReadCommand(device); + } + } + } + } + } + } + }catch(Exception ex) + { + + } + }) + { IsBackground = true }.Start(); + } + } + + + + + + } + + + + + /// <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, key); + if (revertObj != null) + { + if (revertObj.Code == StateCode.SUCCESS) + { + var revertData = Newtonsoft.Json.JsonConvert.DeserializeObject<List<EnvironmentalSensorHistor>>(revertObj.Data.ToString()); + if (revertData == null || revertData.Count == 0) + { +#if DEBUG + List<string> vs = new List<string>() { + "813","313","213","123", + "113","213","183","133", + "133","513","133","413", + "813","313","213","123", + "113","213","183","133", + "133","513","133","413", + }; + 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"}, + 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") + ", "); + +#endif + } + else + { + 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(); + } + + /// <summary> + /// + /// </summary> + public static void UpdataStatus(Function updataTemp) + { + if (!updataTemp.online)//璁惧涓嶅湪绾夸笉鏇存柊鐘舵�� + { + return; + } + 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