From 179c377723a79384efed619e0a5880390998035e Mon Sep 17 00:00:00 2001 From: wxr <wxr@hdlchina.com.cn> Date: 星期二, 03 九月 2024 19:45:26 +0800 Subject: [PATCH] 金茂备份 --- HDL_ON/UI/UI2/1-HomePage/HomePage.cs | 2 HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EchartsOption_Histogram.cs | 68 + HDL-ON_iOS/Resources/Phone/FunctionIcon/FunctionBg/InverterJinmaoFunctionBg.png | 0 HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs | 5 HDL_ON/UI/UI2/FuntionControlView/Acst/InverterJinmaoHistroyPage.cs | 1008 +++++++++++++++++++++++++ HDL-ON_iOS/HDL-ON_iOS.csproj | 1 HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs | 7 HDL-ON_Android/Assets/Phone/FunctionIcon/FunctionBg/InverterJinmaoFunctionBg.png | 0 HDL-ON_Android/HDL-ON_Android.csproj | 2 HDL_ON/UI/UI2/FuntionControlView/Acst/WetarHeaterJinmaoHistoryPage.cs | 895 ++++++++++++++++++++++ HDL_ON/UI/UI0-Public/PublicAssmebly.cs | 305 ------- HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs | 3 HDL_ON/UI/UI2/FuntionControlView/Acst/InverterJinmaoPage.cs | 16 HDL_ON/DAL/DriverLayer/Control.cs | 2 HDL_ON/UI/UI2/FuntionControlView/Acst/WaterHeaterJinmaoPage.cs | 75 - 15 files changed, 1,995 insertions(+), 394 deletions(-) diff --git a/HDL-ON_Android/Assets/Phone/FunctionIcon/FunctionBg/InverterJinmaoFunctionBg.png b/HDL-ON_Android/Assets/Phone/FunctionIcon/FunctionBg/InverterJinmaoFunctionBg.png new file mode 100644 index 0000000..2ac2f2f --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/FunctionIcon/FunctionBg/InverterJinmaoFunctionBg.png Binary files differ diff --git a/HDL-ON_Android/HDL-ON_Android.csproj b/HDL-ON_Android/HDL-ON_Android.csproj index 48fcf1a..e85b97c 100644 --- a/HDL-ON_Android/HDL-ON_Android.csproj +++ b/HDL-ON_Android/HDL-ON_Android.csproj @@ -660,6 +660,8 @@ <AndroidAsset Include="Assets\Phone\FunctionIcon\Acst\Inverter\PvBgRun.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\Acst\Inverter\PvIconRun.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\Acst\Inverter\EsIconFault.png" /> + <AndroidAsset Include="Assets\Phone\FunctionIcon\FunctionBg\AcstFunctionBg.png" /> + <AndroidAsset Include="Assets\Phone\FunctionIcon\FunctionBg\InverterJinmaoFunctionBg.png" /> </ItemGroup> <ItemGroup> <AndroidResource Include="Resources\values\colors.xml" /> diff --git a/HDL-ON_iOS/HDL-ON_iOS.csproj b/HDL-ON_iOS/HDL-ON_iOS.csproj index 43963fe..407a0b3 100644 --- a/HDL-ON_iOS/HDL-ON_iOS.csproj +++ b/HDL-ON_iOS/HDL-ON_iOS.csproj @@ -1842,6 +1842,7 @@ <BundleResource Include="Resources\Phone\FunctionIcon\Acst\WaterHeater\Mode_Economic.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\Acst\WaterHeater\Mode_QuickHeat_On.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\Acst\WaterHeater\ModeFree_True.png" /> + <BundleResource Include="Resources\Phone\FunctionIcon\FunctionBg\InverterJinmaoFunctionBg.png" /> </ItemGroup> <ItemGroup> <ITunesArtwork Include="iTunesArtwork" /> diff --git a/HDL-ON_iOS/Resources/Phone/FunctionIcon/FunctionBg/InverterJinmaoFunctionBg.png b/HDL-ON_iOS/Resources/Phone/FunctionIcon/FunctionBg/InverterJinmaoFunctionBg.png new file mode 100644 index 0000000..2ac2f2f --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/FunctionIcon/FunctionBg/InverterJinmaoFunctionBg.png Binary files differ diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs index 9da198a..b33337b 100644 --- a/HDL_ON/DAL/DriverLayer/Control.cs +++ b/HDL_ON/DAL/DriverLayer/Control.cs @@ -1361,7 +1361,7 @@ break; case SPK.WaterHeaterJinmao: AcstParentPage.UpdateAcstSubInfo(localFunction); - + WaterHeaterJinmaoPage.UpdateStatus(localFunction); break; case SPK.AirSwitch: AirSwitchPage.UpdataState(localFunction); diff --git a/HDL_ON/UI/UI0-Public/PublicAssmebly.cs b/HDL_ON/UI/UI0-Public/PublicAssmebly.cs index 151ee2f..ef20fb3 100644 --- a/HDL_ON/UI/UI0-Public/PublicAssmebly.cs +++ b/HDL_ON/UI/UI0-Public/PublicAssmebly.cs @@ -793,311 +793,6 @@ action(curItemKey); } }; - - - - return; - - // Button lastButton = new Button(); - //Dialog dialog = new Dialog(); - //var pView = new FrameLayout() - //{ - // BackgroundColor = CSS_Color.DialogTransparentColor1, - //}; - //dialog.AddChidren(pView); - - //var itemCount = items.Count; - //var optionBaseViewHeight = ((itemCount > 3 ? itemCount : 3) + 1) * Application.GetRealHeight(50); - //var optionBaseView = new FrameLayout() - //{ - // //Y = Application.GetRealHeight(439), - // Y = Application.GetRealHeight(647) - optionBaseViewHeight, - // Gravity = Gravity.CenterHorizontal, - // Width = Application.GetRealWidth(343), - // //Height = Application.GetRealHeight(208), - // Height = optionBaseViewHeight, - // //AnimateSpeed = 0.3f, - // //Animate = Animate.DownToUp, - // BackgroundColor = CSS_Color.MainBackgroundColor, - // Radius = (uint)Application.GetRealWidth(12), - //}; - //pView.AddChidren(optionBaseView); - - //var topView = new FrameLayout() - //{ - // Gravity = Gravity.CenterHorizontal, - // Width = Application.GetRealWidth(343), - // Height = Application.GetRealHeight(50), - // BackgroundColor = CSS_Color.MainBackgroundColor, - // Radius = (uint)Application.GetRealWidth(12), - //}; - //optionBaseView.AddChidren(topView); - - //var btnTitle = new Button() - //{ - // Gravity = Gravity.CenterHorizontal, - // TextAlignment = TextAlignment.Center, - // Width = Application.GetRealWidth(100), - // TextID = StringId.SceneDelay, - // IsBold = true, - // TextColor = CSS_Color.FirstLevelTitleColor, - // TextSize = CSS_FontSize.SubheadingFontSize, - //}; - //topView.AddChidren(btnTitle); - - //var btnCancel = new Button() - //{ - // X = Application.GetRealWidth(21), - // Width = Application.GetRealWidth(100), - // TextAlignment = TextAlignment.CenterLeft, - // TextColor = CSS_Color.PromptingColor1, - // TextSize = CSS_FontSize.TextFontSize, - // TextID = StringId.Cancel, - //}; - //topView.AddChidren(btnCancel); - - //var btnConfrim = new Button() - //{ - // X = Application.GetRealWidth(160), - // Width = Application.GetRealWidth(160), - // TextAlignment = TextAlignment.CenterRight, - // TextColor = CSS_Color.MainColor, - // TextSize = CSS_FontSize.TextFontSize, - // TextID = StringId.Confirm, - //}; - //topView.AddChidren(btnConfrim); - - //var itemsView = new VerticalScrolViewLayout() - //{ - // Y = topView.Bottom, - // Height = optionBaseViewHeight - Application.GetRealHeight(50), - // ScrollEnabled = itemCount > 4, - //}; - //optionBaseView.AddChidren(itemsView); - - //bool isFrist = true; - //Button btnLastSelectedTip = null; - - //foreach (var item in items) - //{ - // if (isFrist) - // { - // isFrist = false; - // } - // else - // { - // itemsView.AddChidren(new Button() { Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); - // } - // var row = new FrameLayout() - // { - // Height = Application.GetRealHeight(50), - // }; - // itemsView.AddChidren(row); - - // var btnTipSelected = new Button() - // { - // X = Application.GetRealWidth(303), - // Gravity = Gravity.CenterVertical, - // Width = Application.GetRealWidth(28), - // Height= Application.GetRealWidth(28), - // UnSelectedImagePath = "Public/ChooseIcon.png", - // SelectedImagePath = "Public/ChooseOnIcon.png", - // }; - // row.AddChidren(btnTipSelected); - // if( item.Key == curItemKey) - // { - // btnTipSelected.IsSelected = true; - // btnLastSelectedTip = btnTipSelected; - // } - - - // var btnRowTitle = new Button() - // { - // X = Application.GetRealWidth(16), - // Text = item.Value, - // TextSize = CSS_FontSize.TextFontSize, - // TextColor = CSS_Color.FirstLevelTitleColor, - // TextAlignment = TextAlignment.CenterLeft, - // }; - // row.AddChidren(btnRowTitle); - - // btnRowTitle.MouseUpEventHandler = (sender, e) => - // { - // if (btnTipSelected.IsSelected) - // { - // curItemKey = "0"; - // btnTipSelected.IsSelected = false; - // btnLastSelectedTip = null; - // } - // else - // { - // curItemKey = item.Key; - // if (btnLastSelectedTip != null) - // { - // btnLastSelectedTip.IsSelected = false; - // } - // btnTipSelected.IsSelected = true; - // btnLastSelectedTip = btnTipSelected; - // } - // }; - - //} - - //Button btn1 = new Button() - //{ - // Width = Application.GetRealWidth(128), - // Height = Application.GetRealWidth(44), - // TextAlignment = TextAlignment.Center, - // TextSize = CSS_FontSize.SubheadingFontSize, - // TextColor = CSS_Color.FirstLevelTitleColor, - // Text = "30s", - // BorderColor = CSS_Color.PromptingColor1, - // BorderWidth = 1, - // Radius = (uint)Application.GetRealWidth(8), - // SelectedTextColor = CSS_Color.MainBackgroundColor, - // SelectedBackgroundColor = CSS_Color.MainColor, - // X = Application.GetRealWidth(20), - // Y = Application.GetRealHeight(80), - // IsSelected = curItemKey == "30" - //}; - //optionBaseView.AddChidren(btn1); - - - //Button btn2 = new Button() - //{ - // Width = Application.GetRealWidth(128), - // Height = Application.GetRealWidth(44), - // TextAlignment = TextAlignment.Center, - // TextSize = CSS_FontSize.SubheadingFontSize, - // TextColor = CSS_Color.FirstLevelTitleColor, - // Text = "1min", - // BorderColor = CSS_Color.PromptingColor1, - // BorderWidth = 1, - // Radius = (uint)Application.GetRealWidth(8), - // SelectedTextColor = CSS_Color.MainBackgroundColor, - // SelectedBackgroundColor = CSS_Color.MainColor, - // X = Application.GetRealWidth(195), - // Y = Application.GetRealHeight(80), - // IsSelected = curItemKey == "60" - //}; - //optionBaseView.AddChidren(btn2); - - - //Button btn3 = new Button() - //{ - // Width = Application.GetRealWidth(128), - // Height = Application.GetRealWidth(44), - // TextAlignment = TextAlignment.Center, - // TextSize = CSS_FontSize.SubheadingFontSize, - // TextColor = CSS_Color.FirstLevelTitleColor, - // Text = "2min", - // BorderColor = CSS_Color.PromptingColor1, - // BorderWidth = 1, - // Radius = (uint)Application.GetRealWidth(8), - // SelectedTextColor = CSS_Color.MainBackgroundColor, - // SelectedBackgroundColor = CSS_Color.MainColor, - // X = Application.GetRealWidth(20), - // Y = Application.GetRealHeight(140), - // IsSelected = curItemKey == "120" - //}; - //optionBaseView.AddChidren(btn3); - - - //Button btn4 = new Button() - //{ - // Width = Application.GetRealWidth(128), - // Height = Application.GetRealWidth(44), - // TextAlignment = TextAlignment.Center, - // TextSize = CSS_FontSize.SubheadingFontSize, - // TextColor = CSS_Color.FirstLevelTitleColor, - // Text = "5min", - // BorderColor = CSS_Color.PromptingColor1, - // BorderWidth = 1, - // Radius = (uint)Application.GetRealWidth(8), - // SelectedTextColor = CSS_Color.MainBackgroundColor, - // SelectedBackgroundColor = CSS_Color.MainColor, - // X = Application.GetRealWidth(195), - // Y = Application.GetRealHeight(140), - // IsSelected = curItemKey == "300" - //}; - //optionBaseView.AddChidren(btn4); - - - - - //dialog.Show(); - - //pView.MouseUpEventHandler = (sender, e) => - //{ - // dialog.Close(); - //}; - - //btnCancel.MouseUpEventHandler = (sender, e) => - //{ - // dialog.Close(); - //}; - //btnConfrim.MouseUpEventHandler = (sender, e) => - //{ - // action(curItemKey); - // dialog.Close(); - //}; - //btn1.MouseUpEventHandler = (sender, e) => { - // btn1.IsSelected = !btn1.IsSelected; - // btn2.IsSelected = false; - // btn3.IsSelected = false; - // btn4.IsSelected = false; - // if(btn1.IsSelected) - // { - // curItemKey = "30"; - // } - // else - // { - // curItemKey = "0"; - // } - //}; - //btn2.MouseUpEventHandler = (sender, e) => { - // btn2.IsSelected = !btn2.IsSelected; - // btn1.IsSelected = false; - // btn3.IsSelected = false; - // btn4.IsSelected = false; - // if (btn2.IsSelected) - // { - // curItemKey = "60"; - // } - // else - // { - // curItemKey = "0"; - // } - //}; - //btn3.MouseUpEventHandler = (sender, e) => { - // btn3.IsSelected = !btn3.IsSelected; - // btn2.IsSelected = false; - // btn1.IsSelected = false; - // btn4.IsSelected = false; - // if (btn3.IsSelected) - // { - // curItemKey = "120"; - // } - // else - // { - // curItemKey = "0"; - // } - //}; - //btn4.MouseUpEventHandler = (sender, e) => { - // btn4.IsSelected = !btn4.IsSelected; - // btn2.IsSelected = false; - // btn3.IsSelected = false; - // btn1.IsSelected = false; - // if (btn4.IsSelected) - // { - // curItemKey = "300"; - // } - // else - // { - // curItemKey = "0"; - // } - //}; - } } diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs index 7693cb4..5948abb 100644 --- a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs +++ b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs @@ -1790,7 +1790,7 @@ { Height = Application.GetRealWidth(100), Width = Application.GetRealWidth(102), - UnSelectedImagePath = "FunctionIcon/FunctionBg/AcstFunctionBg.png", + UnSelectedImagePath = function.spk == SPK.AcstParent ? "FunctionIcon/FunctionBg/AcstFunctionBg.png" : "FunctionIcon/FunctionBg/InverterJinmaoFunctionBg.png", }; view.AddChidren(btnFunctionViewBg); if (function.spk == SPK.AcstParent) diff --git a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs index 0370365..1aa170b 100644 --- a/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs +++ b/HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs @@ -1179,6 +1179,13 @@ break; case ShowFunction.Acst: case ShowFunction.InverterJinmao: + //if(item == ShowFunction.Acst) + //{ + // btnFunctionViewBg.UnSelectedImagePath = "FunctionIcon/FunctionBg/SecurityMonitoringFunctionBg.png"; + //}else if (item == ShowFunction.InverterJinmao) + //{ + // btnFunctionViewBg.UnSelectedImagePath = "FunctionIcon/FunctionBg/SecurityMonitoringFunctionBg.png"; + //} Button btnJMLogo = new Button() { Y = specialList.Contains(index) ? Application.GetRealWidth(147) : Application.GetRealWidth(104), diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs index abce243..f602898 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs @@ -279,11 +279,6 @@ scene.delay = obj; btnSceneDelayInfo.Text = scene.GetDelayText(); }; - Dictionary<string, string> items = new Dictionary<string, string>(); - items.Add("30", "30s"); - items.Add("60", "1min"); - items.Add("120", "2min"); - items.Add("300", "5min"); new PublicAssmebly().SetSceneDelayDialog( action ,scene.delay); diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs index d84205d..72e11f2 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPage.cs @@ -603,7 +603,8 @@ residenceAddFunctionView.AddChidren(btnResidenceAddFunctionText); #endregion - if (DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl) + bool needShow = false; + if (DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl || needShow) { residenceFunctionCount++; #region ---缁勫悎璋冨厜 diff --git a/HDL_ON/UI/UI2/FuntionControlView/Acst/InverterJinmaoHistroyPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Acst/InverterJinmaoHistroyPage.cs index 87ae412..119e878 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Acst/InverterJinmaoHistroyPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Acst/InverterJinmaoHistroyPage.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; +using HDL_ON.DAL.Server; using HDL_ON.Entity; using HDL_ON.UI.CSS; using Shared; @@ -10,7 +11,41 @@ public class InverterJinmaoHistroyPage : FrameLayout { InverterJinmaoHistroyPage bodyView; - Function device; + Function function; + FrameLayout infoView1; + EchartsOption_Histogram echartOption1; + MyEchartsViewOn infoView1_EchartsView; + Button infoView1_Date_Day; + Button infoView1_Date_Month; + Button infoView1_Date_Year; + Button infoView1_DateInfo_PreClickButton; + Button infoView1_DateInfo_DateTextButton; + Button infoView1_DateInfo_NextClickButton; + Button infoView1_DateInfo_NextIconButton; + Button infoView1_DateInfo_PreIconButton; + QueryType queryType1 = QueryType.day_hour; + int queryTime_Day1 = DateTime.Now.Day; + int queryTime_Month1 = DateTime.Now.Month; + int queryTime_Year1 = DateTime.Now.Year; + string queryTimeString1 = DateTime.Now.ToString("yyyy/MM/dd"); + + + FrameLayout infoView2; + MyEchartsViewOn infoView2_EchartsView; + EchartsOption_Histogram echartOption2; + Button infoView2_Date_Day; + Button infoView2_Date_Month; + Button infoView2_Date_Year; + Button infoView2_DateInfo_PreClickButton; + Button infoView2_DateInfo_DateTextButton; + Button infoView2_DateInfo_NextClickButton; + Button infoView2_DateInfo_NextIconButton; + Button infoView2_DateInfo_PreIconButton; + QueryType queryType2 = QueryType.day_hour; + int queryTime_Day2 = DateTime.Now.Day; + int queryTime_Month2 = DateTime.Now.Month; + int queryTime_Year2 = DateTime.Now.Year; + string queryTimeString2 = DateTime.Now.ToString("yyyy/MM/dd"); /// <summary> @@ -18,10 +53,10 @@ /// </summary> MyEchartsViewOn tempEchartsView; - public InverterJinmaoHistroyPage(Function function) + public InverterJinmaoHistroyPage(Function deviceFunction) { bodyView = this; - device = function; + function = deviceFunction; } public void LoadPage() @@ -149,7 +184,7 @@ Gravity = Gravity.Center, Width = Application.GetRealWidth(200), TextAlignment = TextAlignment.Center, - Text = "2024-8-12", + Text = DateTime.Now.ToString("yyyy-MM-dd"), TextColor = CSS_Color.FirstLevelTitleColor, IsBold = true, TextSize = 16, @@ -169,6 +204,7 @@ var infoView1_DateInfo_NextClickButton = new Button() { + X = Application.GetRealWidth(343 - 18 - 6 -32), Width = Application.GetRealWidth(32 + 6), }; infoView1_DateInfoView.AddChidren(infoView1_DateInfo_NextClickButton); @@ -185,7 +221,7 @@ var echartOption = new EchartsOption_Histogram(); echartOption.xTitle = "鏃堕棿"; - echartOption.yTitle = "娓╁害锛堚剝锛�"; + echartOption.yTitle = "鐢甸噺锛坘w锛�"; echartOption.InitXdataText(new List<string>() { "21","22","23","24","25","26","26","27","28","29", @@ -353,7 +389,7 @@ Gravity = Gravity.Center, Width = Application.GetRealWidth(200), TextAlignment = TextAlignment.Center, - Text = "2024-8-12", + Text = DateTime.Now.ToString("yyyy-MM-dd"), TextColor = CSS_Color.FirstLevelTitleColor, IsBold = true, TextSize = 16, @@ -373,6 +409,7 @@ var infoView2_DateInfo_NextClickButton = new Button() { + X = Application.GetRealWidth(343 - 18 - 6 -32), Width = Application.GetRealWidth(32 + 6), }; infoView2_DateInfoView.AddChidren(infoView2_DateInfo_NextClickButton); @@ -389,7 +426,7 @@ var echartOption2 = new EchartsOption_Histogram(); echartOption2.xTitle = "鏃堕棿"; - echartOption2.yTitle = "娓╁害锛堚剝锛�"; + echartOption2.yTitle = "鐢甸噺锛坘w锛�"; echartOption2.InitXdataText(new List<string>() { "21","22","23","24","25","26","26","27","28","29", @@ -444,8 +481,965 @@ { Height = Application.GetRealWidth(26) }); + + initQueryButton(); } + + + /// <summary> + /// 璇诲彇娓╁害鍊煎巻鍙叉暟鎹� + /// hour=杩�24灏忔椂銆乨ay_hour =鏌愭棩24灏忔椂銆亀eek=杩戜竴鍛ㄣ�乵onth = 杩戜竴鏈堛�乧ustom_month=鏌愬勾鏌愭湀 y/M銆乧ustom_year=鏌愬勾 y + /// </summary> + private void getTempHistory() + { + if (MainPage.NoLoginMode) + { + return; + } + + var loadPage = new Loading() + { + LodingBackgroundColor = 0x88888888, + }; + infoView1.AddChidren(loadPage); + + new System.Threading.Thread(() => + { + try + { + Application.RunOnMainThread(() => + { + loadPage.Start(Language.StringByID(StringId.PleaseWait)); + }); + + switch (queryType1) + { + case QueryType.day_hour: + queryTimeString1 = queryTime_Year1.ToString() + "/" + queryTime_Month1 + "/" + queryTime_Day1; + break; + case QueryType.custom_month: + queryTimeString1 = queryTime_Year1.ToString() + "/" + queryTime_Month1; + break; + case QueryType.custom_year: + queryTimeString1 = queryTime_Year1.ToString(); + break; + } + + var revertObj = new HttpServerRequest().GetSensorHistory(queryType1.ToString(), function.deviceId, InverterJinmao_AttrEnum.pv_electricity.ToString(), queryTimeString1); + if (revertObj != null) + { + if (revertObj.Code == StateCode.SUCCESS) + { + var revertData = Newtonsoft.Json.JsonConvert.DeserializeObject<List<EnvironmentalSensorHistor>>(revertObj.Data.ToString()); + List<string> vs = new List<string>(); + foreach (var data in revertData) + { + vs.Add(data.fieldName); + } + echartOption1.InitXdataText(vs); + echartOption1.InitYdataText(revertData); + + Application.RunOnMainThread(() => + { + infoView1_EchartsView.ShowWithOption(echartOption1.InitOption()); + }); + } + } + } + catch (Exception ex) + { + MainPage.Log($"history error : {ex.Message}"); + } + finally + { + Application.RunOnMainThread(() => + { + loadPage.Hide(); + }); + } + }) + { IsBackground = true }.Start(); + + } + /// <summary> + /// 鑾峰彇鐢ㄦ按閲忓巻鍙茶褰� + /// </summary> + private void getWaterHistory() + { + if (MainPage.NoLoginMode) + { + return; + } + var loadPage = new Loading() + { + LodingBackgroundColor = 0x88888888, + }; + infoView2.AddChidren(loadPage); + + new System.Threading.Thread(() => + { + try + { + Application.RunOnMainThread(() => + { + loadPage.Start(Language.StringByID(StringId.PleaseWait)); + }); + switch (queryType2) + { + case QueryType.day_hour: + queryTimeString2 = queryTime_Year2.ToString() + "/" + queryTime_Month2 + "/" + queryTime_Day2; + break; + case QueryType.custom_month: + queryTimeString2 = queryTime_Year2.ToString() + "/" + queryTime_Month2; + break; + case QueryType.custom_year: + queryTimeString2 = queryTime_Year2.ToString(); + break; + } + + var revertObj = new HttpServerRequest().GetSensorHistory(queryType2.ToString(), function.deviceId, InverterJinmao_AttrEnum.load_electricity.ToString(), queryTimeString2); + if (revertObj != null) + { + if (revertObj.Code == StateCode.SUCCESS) + { + var revertData = Newtonsoft.Json.JsonConvert.DeserializeObject<List<EnvironmentalSensorHistor>>(revertObj.Data.ToString()); + List<string> vs = new List<string>(); + foreach (var data in revertData) + { + vs.Add(data.fieldName); + } + echartOption2.InitXdataText(vs); + echartOption2.InitYdataText(revertData); + + Application.RunOnMainThread(() => + { + infoView2_EchartsView.ShowWithOption(echartOption2.InitOption()); + }); + } + } + } + catch (Exception ex) + { + MainPage.Log($"history 2 error : {ex.Message}"); + } + finally + { + Application.RunOnMainThread(() => + { + loadPage.Hide(); + }); + } + }) + { IsBackground = true }.Start(); + + } + + private void initQueryButton() + { + infoView1_DateInfo_DateTextButton.MouseUpEventHandler = (sender, e) => + { + SetTempQureyDateDialog(); + }; + infoView1_DateInfo_PreClickButton.MouseUpEventHandler = (sender, e) => { + var tempQueryDate = new DateTime(queryTime_Year1, queryTime_Month1, queryTime_Day1); + if (queryType1 == QueryType.day_hour) + { + tempQueryDate = tempQueryDate.AddDays(-1); + if (tempQueryDate.Year == 2023 && tempQueryDate.Month == 1 && tempQueryDate.Day == 1) + { + infoView1_DateInfo_PreIconButton.Visible = false; + infoView1_DateInfo_PreClickButton.Enable = false; + } + if (tempQueryDate.Year == DateTime.Now.Year && tempQueryDate.Month == DateTime.Now.Month && tempQueryDate.Day == DateTime.Now.Day - 1) + { + infoView1_DateInfo_NextIconButton.Visible = true; + infoView1_DateInfo_NextClickButton.Enable = true; + } + } + else if (queryType1 == QueryType.custom_month) + { + tempQueryDate = tempQueryDate.AddMonths(-1); + if (tempQueryDate.Year == 2023 && tempQueryDate.Month == 1) + { + infoView1_DateInfo_PreIconButton.Visible = false; + infoView1_DateInfo_PreClickButton.Enable = false; + } + if (tempQueryDate.Year == DateTime.Now.Year && tempQueryDate.Month == DateTime.Now.Month - 1) + { + infoView1_DateInfo_NextIconButton.Visible = true; + infoView1_DateInfo_NextClickButton.Enable = true; + } + } + else if (queryType1 == QueryType.custom_year) + { + tempQueryDate = tempQueryDate.AddYears(-1); + if (tempQueryDate.Year == 2023) + { + infoView1_DateInfo_PreIconButton.Visible = false; + infoView1_DateInfo_PreClickButton.Enable = false; + } + if (tempQueryDate.Year == DateTime.Now.Year - 1) + { + infoView1_DateInfo_NextIconButton.Visible = true; + infoView1_DateInfo_NextClickButton.Enable = true; + } + } + queryTime_Year1 = tempQueryDate.Year; + queryTime_Month1 = tempQueryDate.Month; + queryTime_Day1 = tempQueryDate.Day; + infoView1_DateInfo_DateTextButton.Text = tempQueryDate.ToString("yyyy-MM-dd"); + getTempHistory(); + }; + infoView1_DateInfo_NextIconButton.Visible = false; + infoView1_DateInfo_NextClickButton.Enable = false; + infoView1_DateInfo_NextClickButton.MouseUpEventHandler = (sender, e) => { + var tempQueryDate = new DateTime(queryTime_Year1, queryTime_Month1, queryTime_Day1); + if (queryType1 == QueryType.day_hour) + { + tempQueryDate = tempQueryDate.AddDays(1); + if (tempQueryDate.Year == 2023 && tempQueryDate.Month == 1 && tempQueryDate.Day == 2) + { + infoView1_DateInfo_PreIconButton.Visible = true; + infoView1_DateInfo_PreClickButton.Enable = true; + } + if (tempQueryDate.Year == DateTime.Now.Year && tempQueryDate.Month == DateTime.Now.Month && tempQueryDate.Day == DateTime.Now.Day) + { + infoView1_DateInfo_NextIconButton.Visible = false; + infoView1_DateInfo_NextClickButton.Enable = false; + } + } + else if (queryType1 == QueryType.custom_month) + { + tempQueryDate = tempQueryDate.AddMonths(1); + if (tempQueryDate.Year == 2023 && tempQueryDate.Month == 2) + { + infoView1_DateInfo_PreIconButton.Visible = true; + infoView1_DateInfo_PreClickButton.Enable = true; + } + if (tempQueryDate.Year == DateTime.Now.Year && tempQueryDate.Month == DateTime.Now.Month) + { + infoView1_DateInfo_NextIconButton.Visible = false; + infoView1_DateInfo_NextClickButton.Enable = false; + } + } + else if (queryType1 == QueryType.custom_year) + { + tempQueryDate = tempQueryDate.AddYears(1); + if (tempQueryDate.Year == 2023) + { + infoView1_DateInfo_PreIconButton.Visible = false; + infoView1_DateInfo_PreClickButton.Enable = false; + } + if (tempQueryDate.Year == DateTime.Now.Year) + { + infoView1_DateInfo_NextIconButton.Visible = false; + infoView1_DateInfo_NextClickButton.Enable = false; + } + } + queryTime_Year1 = tempQueryDate.Year; + queryTime_Month1 = tempQueryDate.Month; + queryTime_Day1 = tempQueryDate.Day; + infoView1_DateInfo_DateTextButton.Text = tempQueryDate.ToString("yyyy-MM-dd"); + getTempHistory(); + }; + + infoView1_Date_Day.MouseUpEventHandler = (sender, e) => { + if (infoView1_Date_Day.IsSelected) + { + return; + } + infoView1_Date_Day.IsSelected = true; + infoView1_Date_Month.IsSelected = false; + infoView1_Date_Year.IsSelected = false; + queryType1 = QueryType.day_hour; + infoView1_DateInfo_DateTextButton.Text = new DateTime(queryTime_Year1, queryTime_Month1, queryTime_Day1).ToString("yyyy-MM-dd"); + getTempHistory(); + }; + infoView1_Date_Month.MouseUpEventHandler = (sender, e) => { + if (infoView1_Date_Month.IsSelected) + { + return; + } + infoView1_Date_Day.IsSelected = false; + infoView1_Date_Month.IsSelected = true; + infoView1_Date_Year.IsSelected = false; + queryType1 = QueryType.custom_month; + infoView1_DateInfo_DateTextButton.Text = new DateTime(queryTime_Year1, queryTime_Month1, queryTime_Day1).ToString("yyyy-MM"); + getTempHistory(); + }; + infoView1_Date_Year.MouseUpEventHandler = (sender, e) => { + if (infoView1_Date_Year.IsSelected) + { + return; + } + infoView1_Date_Day.IsSelected = false; + infoView1_Date_Month.IsSelected = false; + infoView1_Date_Year.IsSelected = true; + queryType1 = QueryType.custom_year; + infoView1_DateInfo_DateTextButton.Text = queryTime_Year1.ToString(); + getTempHistory(); + }; + //-----------鐢ㄦ按 + infoView2_DateInfo_DateTextButton.MouseUpEventHandler = (sender, e) => + { + SetWaterQureyDateDialog(); + }; + infoView2_DateInfo_PreClickButton.MouseUpEventHandler = (sender, e) => { + var waterQueryDate = new DateTime(queryTime_Year2, queryTime_Month2, queryTime_Day2); + if (queryType2 == QueryType.day_hour) + { + waterQueryDate = waterQueryDate.AddDays(-1); + if (waterQueryDate.Year == 2023 && waterQueryDate.Month == 1 && waterQueryDate.Day == 1) + { + infoView2_DateInfo_PreIconButton.Visible = false; + infoView2_DateInfo_PreClickButton.Enable = false; + } + if (waterQueryDate.Year == DateTime.Now.Year && waterQueryDate.Month == DateTime.Now.Month && waterQueryDate.Day == DateTime.Now.Day - 1) + { + infoView2_DateInfo_NextIconButton.Visible = true; + infoView2_DateInfo_NextClickButton.Enable = true; + } + } + else if (queryType2 == QueryType.custom_month) + { + waterQueryDate = waterQueryDate.AddMonths(-1); + if (waterQueryDate.Year == 2023 && waterQueryDate.Month == 1) + { + infoView2_DateInfo_PreIconButton.Visible = false; + infoView2_DateInfo_PreClickButton.Enable = false; + } + if (waterQueryDate.Year == DateTime.Now.Year && waterQueryDate.Month == DateTime.Now.Month - 1) + { + infoView2_DateInfo_NextIconButton.Visible = true; + infoView2_DateInfo_NextClickButton.Enable = true; + } + } + else if (queryType2 == QueryType.custom_year) + { + waterQueryDate = waterQueryDate.AddYears(-1); + if (waterQueryDate.Year == 2023) + { + infoView2_DateInfo_PreIconButton.Visible = false; + infoView2_DateInfo_PreClickButton.Enable = false; + } + if (waterQueryDate.Year == DateTime.Now.Year - 1) + { + infoView2_DateInfo_NextIconButton.Visible = true; + infoView2_DateInfo_NextClickButton.Enable = true; + } + } + queryTime_Year2 = waterQueryDate.Year; + queryTime_Month2 = waterQueryDate.Month; + queryTime_Day2 = waterQueryDate.Day; + infoView2_DateInfo_DateTextButton.Text = waterQueryDate.ToString("yyyy-MM-dd"); + getWaterHistory(); + }; + infoView2_DateInfo_NextIconButton.Visible = false; + infoView2_DateInfo_NextClickButton.Enable = false; + infoView2_DateInfo_NextClickButton.MouseUpEventHandler = (sender, e) => { + var waterQueryDate = new DateTime(queryTime_Year2, queryTime_Month2, queryTime_Day2); + if (queryType2 == QueryType.day_hour) + { + waterQueryDate = waterQueryDate.AddDays(1); + if (waterQueryDate.Year == 2023 && waterQueryDate.Month == 1 && waterQueryDate.Day == 2) + { + infoView2_DateInfo_PreIconButton.Visible = true; + infoView2_DateInfo_PreClickButton.Enable = true; + } + if (waterQueryDate.Year == DateTime.Now.Year && waterQueryDate.Month == DateTime.Now.Month && waterQueryDate.Day == DateTime.Now.Day) + { + infoView2_DateInfo_NextIconButton.Visible = false; + infoView2_DateInfo_NextClickButton.Enable = false; + } + } + else if (queryType2 == QueryType.custom_month) + { + waterQueryDate = waterQueryDate.AddMonths(1); + if (waterQueryDate.Year == 2023 && waterQueryDate.Month == 2) + { + infoView2_DateInfo_PreIconButton.Visible = true; + infoView2_DateInfo_PreClickButton.Enable = true; + } + if (waterQueryDate.Year == DateTime.Now.Year && waterQueryDate.Month == DateTime.Now.Month) + { + infoView2_DateInfo_NextIconButton.Visible = false; + infoView2_DateInfo_NextClickButton.Enable = false; + } + } + else if (queryType2 == QueryType.custom_year) + { + waterQueryDate = waterQueryDate.AddYears(1); + if (waterQueryDate.Year == 2023) + { + infoView2_DateInfo_PreIconButton.Visible = false; + infoView2_DateInfo_PreClickButton.Enable = false; + } + if (waterQueryDate.Year == DateTime.Now.Year) + { + infoView2_DateInfo_NextIconButton.Visible = false; + infoView2_DateInfo_NextClickButton.Enable = false; + } + } + queryTime_Year2 = waterQueryDate.Year; + queryTime_Month2 = waterQueryDate.Month; + queryTime_Day2 = waterQueryDate.Day; + infoView2_DateInfo_DateTextButton.Text = waterQueryDate.ToString("yyyy-MM-dd"); + getWaterHistory(); + }; + infoView2_Date_Day.MouseDownEventHandler = (sender, e) => { + if (infoView2_Date_Day.IsSelected) + { + return; + } + infoView2_Date_Day.IsSelected = true; + infoView2_Date_Month.IsSelected = false; + infoView2_Date_Year.IsSelected = false; + queryType2 = QueryType.day_hour; + infoView2_DateInfo_DateTextButton.Text = new DateTime(queryTime_Year2, queryTime_Month2, queryTime_Day2).ToString("yyyy-MM-dd"); + getWaterHistory(); + }; + infoView2_Date_Month.MouseDownEventHandler = (sender, e) => { + if (infoView2_Date_Month.IsSelected) + { + return; + } + infoView2_Date_Day.IsSelected = false; + infoView2_Date_Month.IsSelected = true; + infoView2_Date_Year.IsSelected = false; + queryType2 = QueryType.custom_month; + infoView2_DateInfo_DateTextButton.Text = new DateTime(queryTime_Year2, queryTime_Month2, queryTime_Day2).ToString("yyyy-MM"); + getWaterHistory(); + }; + infoView2_Date_Year.MouseDownEventHandler = (sender, e) => { + if (infoView2_Date_Year.IsSelected) + { + return; + } + infoView2_Date_Day.IsSelected = false; + infoView2_Date_Month.IsSelected = false; + infoView2_Date_Year.IsSelected = true; + queryType2 = QueryType.custom_year; + infoView2_DateInfo_DateTextButton.Text = queryTime_Year2.ToString(); + getWaterHistory(); + }; + + } + + /// <summary> + /// </summary> + public void SetTempQureyDateDialog() + { + var pickerItems_Year = new List<string>(); + List<string> pickerItems_Month = null; + List<string> pickerItems_Day = null; + + int item1 = queryTime_Year1; + int item2 = queryTime_Month1; + int item3 = queryTime_Day1; + + pickerItems_Year.Add("2023"); + while (DateTime.Now.Year > 2022 + pickerItems_Year.Count) + { + pickerItems_Year.Add((2023 + pickerItems_Year.Count).ToString()); + } + + if (queryType1 == QueryType.custom_month || queryType1 == QueryType.day_hour) + { + pickerItems_Month = new List<string>(); + if (queryTime_Year1 == DateTime.Now.Year) + { + int addMonth = 0; + while (DateTime.Now.Month > addMonth) + { + addMonth++; + pickerItems_Month.Add(addMonth.ToString()); + } + } + else + { + for (var i = 1; i < 13; i++) + { + pickerItems_Month.Add(i.ToString()); + } + } + if (queryType1 == QueryType.day_hour) + { + pickerItems_Day = new List<string>(); + if (queryTime_Month1 == DateTime.Now.Month) + { + int addDay = 0; + while (DateTime.Now.Day > addDay) + { + addDay++; + pickerItems_Day.Add(addDay.ToString()); + } + } + else + { + for (var i = 1; i <= DateTime.DaysInMonth(queryTime_Year1, queryTime_Month1); i++) + { + pickerItems_Day.Add(i.ToString()); + } + } + } + } + + Dialog dialog = new Dialog(); + + var pView = new FrameLayout() + { + BackgroundColor = CSS_Color.DialogTransparentColor1, + }; + dialog.AddChidren(pView); + + var optionBaseView = new FrameLayout() + { + Y = Application.GetRealHeight(456 - 60), + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(343), + Height = Application.GetRealHeight(260), + AnimateSpeed = 0.3f, + Animate = Animate.DownToUp, + BackgroundColor = CSS_Color.MainBackgroundColor, + Radius = (uint)Application.GetRealWidth(12), + }; + pView.AddChidren(optionBaseView); + + var topView = new FrameLayout() + { + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(343), + Height = Application.GetRealHeight(40), + BackgroundColor = CSS_Color.MainBackgroundColor, + Radius = (uint)Application.GetRealWidth(12), + }; + optionBaseView.AddChidren(topView); + topView.AddChidren(new Button() { Y = Application.GetRealHeight(39), Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor }); + + var btnCancel = new Button() + { + X = Application.GetRealWidth(21), + Width = Application.GetRealWidth(100), + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.PromptingColor1, + TextSize = CSS_FontSize.TextFontSize, + TextID = StringId.Cancel, + }; + topView.AddChidren(btnCancel); + + var btnConfrim = new Button() + { + X = Application.GetRealWidth(160), + Width = Application.GetRealWidth(160), + TextAlignment = TextAlignment.CenterRight, + TextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.TextFontSize, + TextID = StringId.Confirm, + }; + topView.AddChidren(btnConfrim); + + UIPickerView uIPickerView = new UIPickerView() + { + Y = Application.GetRealHeight(40), + Height = Application.GetRealHeight(210), + Radius = (uint)Application.GetRealWidth(12), + }; + optionBaseView.AddChidren(uIPickerView); + uIPickerView.setNPicker(pickerItems_Year, pickerItems_Month, pickerItems_Day); + uIPickerView.setCurrentItems(pickerItems_Year.IndexOf(queryTime_Year1.ToString()), + pickerItems_Month == null ? 0 : pickerItems_Month.IndexOf(queryTime_Month1.ToString()), + pickerItems_Day == null ? 0 : pickerItems_Day.IndexOf(queryTime_Day1.ToString())); + + dialog.Show(); + + pView.MouseUpEventHandler = (sender, e) => + { + dialog.Close(); + }; + + btnCancel.MouseUpEventHandler = (sender, e) => + { + dialog.Close(); + }; + uIPickerView.OnSelectChangeEvent = (int1, int2, int3) => + { + if (pickerItems_Year[int1] != item1.ToString()) + { + int.TryParse(pickerItems_Year[int1], out item1); + if (queryType1 == QueryType.custom_month || queryType1 == QueryType.day_hour) + { + pickerItems_Month = new List<string>(); + if (item1 == DateTime.Now.Year) + { + int addMonth = 0; + while (DateTime.Now.Month > addMonth) + { + addMonth++; + pickerItems_Month.Add(addMonth.ToString()); + } + } + else + { + for (var i = 1; i < 13; i++) + { + pickerItems_Month.Add(i.ToString()); + } + } + if (queryType1 == QueryType.day_hour) + { + pickerItems_Day = new List<string>(); + if (item1 == DateTime.Now.Year && item2 == DateTime.Now.Month) + { + int addDay = 0; + while (DateTime.Now.Day > addDay) + { + addDay++; + pickerItems_Day.Add(addDay.ToString()); + } + } + else + { + for (var i = 1; i <= DateTime.DaysInMonth(item1, item2); i++) + { + pickerItems_Day.Add(i.ToString()); + } + } + } + } + uIPickerView.setNPicker(pickerItems_Year, pickerItems_Month, pickerItems_Day); + uIPickerView.setCurrentItems(pickerItems_Year.IndexOf(item1.ToString()), + pickerItems_Month == null ? 0 : pickerItems_Month.IndexOf(item2.ToString()), + pickerItems_Day == null ? 0 : pickerItems_Day.IndexOf(item3.ToString())); + + } + if (pickerItems_Month != null) + { + if (pickerItems_Month[int2] != item2.ToString()) + { + int.TryParse(pickerItems_Month[int2], out item2); + if (queryType1 == QueryType.day_hour) + { + pickerItems_Day = new List<string>(); + if (item1 == DateTime.Now.Year && item2 == DateTime.Now.Month) + { + int addDay = 0; + while (DateTime.Now.Day > addDay) + { + addDay++; + pickerItems_Day.Add(addDay.ToString()); + } + } + else + { + for (var i = 1; i <= DateTime.DaysInMonth(item1, item2); i++) + { + pickerItems_Day.Add(i.ToString()); + } + } + } + + uIPickerView.setNPicker(pickerItems_Year, pickerItems_Month, pickerItems_Day); + uIPickerView.setCurrentItems(pickerItems_Year.IndexOf(item1.ToString()), + pickerItems_Month == null ? 0 : pickerItems_Month.IndexOf(item2.ToString()), + pickerItems_Day == null ? 0 : pickerItems_Day.IndexOf(item3.ToString())); + } + } + if (pickerItems_Day != null) + { + if (int3 >= pickerItems_Day.Count) + { + int3 = 0; + } + if (pickerItems_Day[int3] != item3.ToString()) + { + int.TryParse(pickerItems_Day[int3], out item3); + } + } + }; + btnConfrim.MouseUpEventHandler = (sender, e) => + { + dialog.Close(); + queryTime_Year1 = item1; + infoView1_DateInfo_DateTextButton.Text = queryTime_Year1.ToString(); + if (queryType1 == QueryType.custom_month || queryType1 == QueryType.day_hour) + { + if (item2 != queryTime_Month1) + { + queryTime_Month1 = item2; + } + infoView1_DateInfo_DateTextButton.Text = new DateTime(queryTime_Year1, queryTime_Month1, queryTime_Day1).ToString("yyyy-MM"); + if (queryType1 == QueryType.day_hour) + { + if (item3 != queryTime_Day1) + { + queryTime_Day1 = item3; + } + infoView1_DateInfo_DateTextButton.Text = new DateTime(queryTime_Year1, queryTime_Month1, queryTime_Day1).ToString("yyyy-MM-dd"); + } + } + getTempHistory(); + }; + + } + + public void SetWaterQureyDateDialog() + { + var pickerItems_Year = new List<string>(); + List<string> pickerItems_Month = null; + List<string> pickerItems_Day = null; + + int item1 = queryTime_Year2; + int item2 = queryTime_Month2; + int item3 = queryTime_Day2; + + pickerItems_Year.Add("2023"); + while (DateTime.Now.Year > 2022 + pickerItems_Year.Count) + { + pickerItems_Year.Add((2023 + pickerItems_Year.Count).ToString()); + } + + if (queryType2 == QueryType.custom_month || queryType2 == QueryType.day_hour) + { + pickerItems_Month = new List<string>(); + if (queryTime_Year2 == DateTime.Now.Year) + { + int addMonth = 0; + while (DateTime.Now.Month > addMonth) + { + addMonth++; + pickerItems_Month.Add(addMonth.ToString()); + } + } + else + { + for (var i = 1; i < 13; i++) + { + pickerItems_Month.Add(i.ToString()); + } + } + if (queryType2 == QueryType.day_hour) + { + pickerItems_Day = new List<string>(); + if (queryTime_Month2 == DateTime.Now.Month) + { + int addDay = 0; + while (DateTime.Now.Day > addDay) + { + addDay++; + pickerItems_Day.Add(addDay.ToString()); + } + } + else + { + for (var i = 1; i <= DateTime.DaysInMonth(queryTime_Year2, queryTime_Month2); i++) + { + pickerItems_Day.Add(i.ToString()); + } + } + } + } + + Dialog dialog = new Dialog(); + + var pView = new FrameLayout() + { + BackgroundColor = CSS_Color.DialogTransparentColor1, + }; + dialog.AddChidren(pView); + + var optionBaseView = new FrameLayout() + { + Y = Application.GetRealHeight(456 - 60), + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(343), + Height = Application.GetRealHeight(260), + AnimateSpeed = 0.3f, + Animate = Animate.DownToUp, + BackgroundColor = CSS_Color.MainBackgroundColor, + Radius = (uint)Application.GetRealWidth(12), + }; + pView.AddChidren(optionBaseView); + + var topView = new FrameLayout() + { + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(343), + Height = Application.GetRealHeight(40), + BackgroundColor = CSS_Color.MainBackgroundColor, + Radius = (uint)Application.GetRealWidth(12), + }; + optionBaseView.AddChidren(topView); + topView.AddChidren(new Button() { Y = Application.GetRealHeight(39), Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor }); + + var btnCancel = new Button() + { + X = Application.GetRealWidth(21), + Width = Application.GetRealWidth(100), + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.PromptingColor1, + TextSize = CSS_FontSize.TextFontSize, + TextID = StringId.Cancel, + }; + topView.AddChidren(btnCancel); + + var btnConfrim = new Button() + { + X = Application.GetRealWidth(160), + Width = Application.GetRealWidth(160), + TextAlignment = TextAlignment.CenterRight, + TextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.TextFontSize, + TextID = StringId.Confirm, + }; + topView.AddChidren(btnConfrim); + + UIPickerView uIPickerView = new UIPickerView() + { + Y = Application.GetRealHeight(40), + Height = Application.GetRealHeight(210), + Radius = (uint)Application.GetRealWidth(12), + }; + optionBaseView.AddChidren(uIPickerView); + uIPickerView.setNPicker(pickerItems_Year, pickerItems_Month, pickerItems_Day); + uIPickerView.setCurrentItems(pickerItems_Year.IndexOf(queryTime_Year2.ToString()), + pickerItems_Month == null ? 0 : pickerItems_Month.IndexOf(queryTime_Month2.ToString()), + pickerItems_Day == null ? 0 : pickerItems_Day.IndexOf(queryTime_Day2.ToString())); + + dialog.Show(); + + pView.MouseUpEventHandler = (sender, e) => + { + dialog.Close(); + }; + + btnCancel.MouseUpEventHandler = (sender, e) => + { + dialog.Close(); + }; + uIPickerView.OnSelectChangeEvent = (int1, int2, int3) => + { + if (pickerItems_Year[int1] != item1.ToString()) + { + int.TryParse(pickerItems_Year[int1], out item1); + if (queryType2 == QueryType.custom_month || queryType2 == QueryType.day_hour) + { + pickerItems_Month = new List<string>(); + if (item1 == DateTime.Now.Year) + { + int addMonth = 0; + while (DateTime.Now.Month > addMonth) + { + addMonth++; + pickerItems_Month.Add(addMonth.ToString()); + } + } + else + { + for (var i = 1; i < 13; i++) + { + pickerItems_Month.Add(i.ToString()); + } + } + if (queryType2 == QueryType.day_hour) + { + pickerItems_Day = new List<string>(); + if (item1 == DateTime.Now.Year && item2 == DateTime.Now.Month) + { + int addDay = 0; + while (DateTime.Now.Day > addDay) + { + addDay++; + pickerItems_Day.Add(addDay.ToString()); + } + } + else + { + for (var i = 1; i <= DateTime.DaysInMonth(item1, item2); i++) + { + pickerItems_Day.Add(i.ToString()); + } + } + } + } + uIPickerView.setNPicker(pickerItems_Year, pickerItems_Month, pickerItems_Day); + uIPickerView.setCurrentItems(pickerItems_Year.IndexOf(item1.ToString()), + pickerItems_Month == null ? 0 : pickerItems_Month.IndexOf(item2.ToString()), + pickerItems_Day == null ? 0 : pickerItems_Day.IndexOf(item3.ToString())); + + } + if (pickerItems_Month != null) + { + if (pickerItems_Month[int2] != item2.ToString()) + { + int.TryParse(pickerItems_Month[int2], out item2); + if (queryType2 == QueryType.day_hour) + { + pickerItems_Day = new List<string>(); + if (item1 == DateTime.Now.Year && item2 == DateTime.Now.Month) + { + int addDay = 0; + while (DateTime.Now.Day > addDay) + { + addDay++; + pickerItems_Day.Add(addDay.ToString()); + } + } + else + { + for (var i = 1; i <= DateTime.DaysInMonth(item1, item2); i++) + { + pickerItems_Day.Add(i.ToString()); + } + } + } + + uIPickerView.setNPicker(pickerItems_Year, pickerItems_Month, pickerItems_Day); + uIPickerView.setCurrentItems(pickerItems_Year.IndexOf(item1.ToString()), + pickerItems_Month == null ? 0 : pickerItems_Month.IndexOf(item2.ToString()), + pickerItems_Day == null ? 0 : pickerItems_Day.IndexOf(item3.ToString())); + } + } + if (pickerItems_Day != null) + { + if (int3 >= pickerItems_Day.Count) + { + int3 = 0; + } + if (pickerItems_Day[int3] != item3.ToString()) + { + int.TryParse(pickerItems_Day[int3], out item3); + } + } + }; + btnConfrim.MouseUpEventHandler = (sender, e) => + { + dialog.Close(); + queryTime_Year2 = item1; + infoView2_DateInfo_DateTextButton.Text = queryTime_Year2.ToString(); + if (queryType2 == QueryType.custom_month || queryType2 == QueryType.day_hour) + { + if (item2 != queryTime_Month2) + { + queryTime_Month2 = item2; + } + infoView2_DateInfo_DateTextButton.Text = new DateTime(queryTime_Year2, queryTime_Month2, queryTime_Day2).ToString("yyyy-MM"); + if (queryType2 == QueryType.day_hour) + { + if (item3 != queryTime_Day2) + { + queryTime_Day2 = item3; + } + infoView2_DateInfo_DateTextButton.Text = new DateTime(queryTime_Year2, queryTime_Month2, queryTime_Day2).ToString("yyyy-MM-dd"); + } + } + getWaterHistory(); + }; + + } + + + } } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Acst/InverterJinmaoPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Acst/InverterJinmaoPage.cs index b746317..e0665d3 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Acst/InverterJinmaoPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Acst/InverterJinmaoPage.cs @@ -145,10 +145,10 @@ #if __IOS__ pvGenerate_TodayValuesButton.TextAlignment = TextAlignment.TopLeft; - pvGenerate_TodayValuesButton.Width = pvGenerate_TodayValuesButton.GetTextWidth() + Application.GetRealWidth(8); + pvGenerate_TodayValuesButton.Width = pvGenerate_TodayValuesButton.GetTextWidth() + Application.GetRealWidth(4); #else pvGenerate_TodayValuesButton.TextAlignment = TextAlignment.BottomLeft; - pvGenerate_TodayValuesButton.Width = pvGenerate_TodayValuesButton.GetTextWidth(); + pvGenerate_TodayValuesButton.Width = pvGenerate_TodayValuesButton.GetTextWidth() + Application.GetRealWidth(4); #endif pvGenerate_todayUintButton = new Button() { @@ -838,11 +838,7 @@ TextAlignment = TextAlignment.BottomLeft, IsBold = true, }; -#if __IOS__ socialContribution_Info1_ValuesButton.Width = socialContribution_Info1_ValuesButton.GetTextWidth() + Application.GetRealWidth(8); -#else - socialContribution_Info1_ValuesButton.Width = socialContribution_Info1_ValuesButton.GetTextWidth(); -#endif socialContribution_InfoView_1.AddChidren(socialContribution_Info1_ValuesButton); var socialContribution_Info1_UintButton = new Button() @@ -908,11 +904,7 @@ TextAlignment = TextAlignment.BottomLeft, IsBold = true, }; -#if __IOS__ socialContribution_Info2_ValuesButton.Width = socialContribution_Info2_ValuesButton.GetTextWidth() + Application.GetRealWidth(8); -#else - socialContribution_Info2_ValuesButton.Width = socialContribution_Info2_ValuesButton.GetTextWidth(); -#endif socialContribution_InfoView_2.AddChidren(socialContribution_Info2_ValuesButton); var socialContribution_Info2_UintButton = new Button() @@ -978,11 +970,7 @@ TextAlignment = TextAlignment.BottomLeft, IsBold = true, }; -#if __IOS__ socialContribution_Info3_ValuesButton.Width = socialContribution_Info3_ValuesButton.GetTextWidth() + Application.GetRealWidth(8); -#else - socialContribution_Info3_ValuesButton.Width = socialContribution_Info3_ValuesButton.GetTextWidth(); -#endif socialContribution_InfoView_3.AddChidren(socialContribution_Info3_ValuesButton); var socialContribution_Info3_UintButton = new Button() diff --git a/HDL_ON/UI/UI2/FuntionControlView/Acst/WaterHeaterJinmaoPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Acst/WaterHeaterJinmaoPage.cs index ae12336..2202ec8 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Acst/WaterHeaterJinmaoPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Acst/WaterHeaterJinmaoPage.cs @@ -10,7 +10,7 @@ { public class WaterHeaterJinmaoPage : FrameLayout { - FrameLayout bodyView; + static WaterHeaterJinmaoPage bodyView; VerticalScrolViewLayout contentView; FrameLayout bottomView; Function function; @@ -255,12 +255,9 @@ TextAlignment = TextAlignment.TopCenter, Text = function.GetAttrState(WaterHeaterJinmao_AttrEnum.temp.ToString(), "---"), }; -#if __IOS__ btnTempValues.Width = btnTempValues.GetTextWidth() + Application.GetRealWidth(8); -#else - btnTempValues.Width = btnTempValues.GetTextWidth(); -#endif btnTempValues.Gravity = Gravity.CenterHorizontal; + infoView_Temp_View.AddChidren(btnTempValues); btnTempValuesUint = new Button() @@ -433,11 +430,7 @@ TextAlignment = TextAlignment.TopCenter, Text = function.GetAttrState(WaterHeaterJinmao_AttrEnum.set_temp.ToString(), "---"), }; -#if __IOS__ setTemp_ValuesButton.Width = setTemp_ValuesButton.GetTextWidth() + Application.GetRealWidth(8); -#else - setTemp_ValuesButton.Width = setTemp_ValuesButton.GetTextWidth(); -#endif setTemp_ValuesButton.Gravity = Gravity.CenterHorizontal; setTempView.AddChidren(setTemp_ValuesButton); @@ -733,11 +726,7 @@ TextAlignment = TextAlignment.BottomLeft, IsBold = true, }; -#if __IOS__ socialContribution_Info1_ValuesButton.Width = socialContribution_Info1_ValuesButton.GetTextWidth() + Application.GetRealWidth(8); -#else - socialContribution_Info1_ValuesButton.Width = socialContribution_Info1_ValuesButton.GetTextWidth(); -#endif socialContribution_InfoView_1.AddChidren(socialContribution_Info1_ValuesButton); socialContribution_Info1_UintButton = new Button() @@ -803,11 +792,7 @@ TextAlignment = TextAlignment.BottomLeft, IsBold = true, }; -#if __IOS__ socialContribution_Info2_ValuesButton.Width = socialContribution_Info2_ValuesButton.GetTextWidth() + Application.GetRealWidth(8); -#else - socialContribution_Info2_ValuesButton.Width = socialContribution_Info2_ValuesButton.GetTextWidth(); -#endif socialContribution_InfoView_2.AddChidren(socialContribution_Info2_ValuesButton); @@ -874,11 +859,7 @@ TextAlignment = TextAlignment.BottomLeft, IsBold = true, }; -#if __IOS__ socialContribution_Info3_ValuesButton.Width = socialContribution_Info3_ValuesButton.GetTextWidth() + Application.GetRealWidth(8); -#else - socialContribution_Info3_ValuesButton.Width = socialContribution_Info3_ValuesButton.GetTextWidth(); -#endif socialContribution_InfoView_3.AddChidren(socialContribution_Info3_ValuesButton); socialContribution_Info3_UintButton = new Button() @@ -1026,84 +1007,84 @@ /// 鏇存柊鐣岄潰鐘舵�� /// </summary> /// <param name="temp"></param> - public void UpdateStatus(Function temp) + public static void UpdateStatus(Function temp) { if (bodyView == null) { return; } //鍏嶈垂鐑按 - if (function.GetAttrState(WaterHeaterJinmao_AttrEnum.mode_free.ToString()) != temp.GetAttrState(WaterHeaterJinmao_AttrEnum.mode_free.ToString())) + if (bodyView.function.GetAttrState(WaterHeaterJinmao_AttrEnum.mode_free.ToString()) != temp.GetAttrState(WaterHeaterJinmao_AttrEnum.mode_free.ToString())) { - function.SetAttrState(WaterHeaterJinmao_AttrEnum.mode_free.ToString(), temp.GetAttrState(WaterHeaterJinmao_AttrEnum.mode_free.ToString())); + bodyView.function.SetAttrState(WaterHeaterJinmao_AttrEnum.mode_free.ToString(), temp.GetAttrState(WaterHeaterJinmao_AttrEnum.mode_free.ToString())); Application.RunOnMainThread(() => { - updateFreeMode(); + bodyView.updateFreeMode(); }); } //鐑按娓╁害 - if (function.GetAttrState(WaterHeaterJinmao_AttrEnum.temp.ToString()) != temp.GetAttrState(WaterHeaterJinmao_AttrEnum.temp.ToString())) + if (bodyView.function.GetAttrState(WaterHeaterJinmao_AttrEnum.temp.ToString()) != temp.GetAttrState(WaterHeaterJinmao_AttrEnum.temp.ToString())) { - function.SetAttrState(WaterHeaterJinmao_AttrEnum.temp.ToString(), temp.GetAttrState(WaterHeaterJinmao_AttrEnum.temp.ToString())); + bodyView.function.SetAttrState(WaterHeaterJinmao_AttrEnum.temp.ToString(), temp.GetAttrState(WaterHeaterJinmao_AttrEnum.temp.ToString())); Application.RunOnMainThread(() => { - updateTemp(); + bodyView.updateTemp(); }); } //鐑按鍣ㄦā寮� - if (function.GetAttrState(WaterHeaterJinmao_AttrEnum.mode.ToString()) != temp.GetAttrState(WaterHeaterJinmao_AttrEnum.mode.ToString())) + if (bodyView.function.GetAttrState(WaterHeaterJinmao_AttrEnum.mode.ToString()) != temp.GetAttrState(WaterHeaterJinmao_AttrEnum.mode.ToString())) { - function.SetAttrState(WaterHeaterJinmao_AttrEnum.mode.ToString(), temp.GetAttrState(WaterHeaterJinmao_AttrEnum.mode.ToString())); + bodyView.function.SetAttrState(WaterHeaterJinmao_AttrEnum.mode.ToString(), temp.GetAttrState(WaterHeaterJinmao_AttrEnum.mode.ToString())); Application.RunOnMainThread(() => { - updateModeUI(); + bodyView.updateModeUI(); }); } //鐑按鍣ㄨ缃俯搴� - if (function.GetAttrState(WaterHeaterJinmao_AttrEnum.set_temp.ToString()) != temp.GetAttrState(WaterHeaterJinmao_AttrEnum.set_temp.ToString())) + if (bodyView.function.GetAttrState(WaterHeaterJinmao_AttrEnum.set_temp.ToString()) != temp.GetAttrState(WaterHeaterJinmao_AttrEnum.set_temp.ToString())) { - function.SetAttrState(WaterHeaterJinmao_AttrEnum.set_temp.ToString(), temp.GetAttrState(WaterHeaterJinmao_AttrEnum.set_temp.ToString())); + bodyView.function.SetAttrState(WaterHeaterJinmao_AttrEnum.set_temp.ToString(), temp.GetAttrState(WaterHeaterJinmao_AttrEnum.set_temp.ToString())); Application.RunOnMainThread(() => { - updateSetTemp(); + bodyView.updateSetTemp(); }); } //鐑按娴侀噺 - if (function.GetAttrState(WaterHeaterJinmao_AttrEnum.flow.ToString()) != temp.GetAttrState(WaterHeaterJinmao_AttrEnum.flow.ToString())) + if (bodyView.function.GetAttrState(WaterHeaterJinmao_AttrEnum.flow.ToString()) != temp.GetAttrState(WaterHeaterJinmao_AttrEnum.flow.ToString())) { Application.RunOnMainThread(() => { - updateFlow(); + bodyView.updateFlow(); }); } //鐑按鎬婚噺 - if (function.GetAttrState(WaterHeaterJinmao_AttrEnum.volume.ToString()) != temp.GetAttrState(WaterHeaterJinmao_AttrEnum.volume.ToString()) || - function.GetAttrState(WaterHeaterJinmao_AttrEnum.recycl_volume.ToString()) != temp.GetAttrState(WaterHeaterJinmao_AttrEnum.recycl_volume.ToString())) + if (bodyView.function.GetAttrState(WaterHeaterJinmao_AttrEnum.volume.ToString()) != temp.GetAttrState(WaterHeaterJinmao_AttrEnum.volume.ToString()) || + bodyView.function.GetAttrState(WaterHeaterJinmao_AttrEnum.recycl_volume.ToString()) != temp.GetAttrState(WaterHeaterJinmao_AttrEnum.recycl_volume.ToString())) { Application.RunOnMainThread(() => { - updateVolume(); + bodyView.updateVolume(); }); } //绀句細璐$尞-鑺傜數閲� - if (function.GetAttrState(WaterHeaterJinmao_AttrEnum.energy_electricity.ToString()) != temp.GetAttrState(WaterHeaterJinmao_AttrEnum.energy_electricity.ToString())) + if (bodyView.function.GetAttrState(WaterHeaterJinmao_AttrEnum.energy_electricity.ToString()) != temp.GetAttrState(WaterHeaterJinmao_AttrEnum.energy_electricity.ToString())) { - updateSocialContribution1(); + bodyView.updateSocialContribution1(); } //绀句細璐$尞-co2 - if (function.GetAttrState(WaterHeaterJinmao_AttrEnum.co2.ToString()) != temp.GetAttrState(WaterHeaterJinmao_AttrEnum.co2.ToString())) + if (bodyView.function.GetAttrState(WaterHeaterJinmao_AttrEnum.co2.ToString()) != temp.GetAttrState(WaterHeaterJinmao_AttrEnum.co2.ToString())) { - updateSocialContribution2(); + bodyView.updateSocialContribution2(); } //绀句細璐$尞-妞嶆爲 - if (function.GetAttrState(WaterHeaterJinmao_AttrEnum.trees.ToString()) != temp.GetAttrState(WaterHeaterJinmao_AttrEnum.trees.ToString())) + if (bodyView.function.GetAttrState(WaterHeaterJinmao_AttrEnum.trees.ToString()) != temp.GetAttrState(WaterHeaterJinmao_AttrEnum.trees.ToString())) { - updateSocialContribution3(); + bodyView.updateSocialContribution3(); } //寮�鍏虫寜閽� - if (function.GetAttrState(FunctionAttributeKey.OnOff.ToString()) != temp.GetAttrState(FunctionAttributeKey.OnOff.ToString())) + if (bodyView.function.GetAttrState(FunctionAttributeKey.OnOff.ToString()) != temp.GetAttrState(FunctionAttributeKey.OnOff.ToString())) { - updatePowerButton(); + bodyView.updatePowerButton(); } } diff --git a/HDL_ON/UI/UI2/FuntionControlView/Acst/WetarHeaterJinmaoHistoryPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Acst/WetarHeaterJinmaoHistoryPage.cs index ffa1362..b1d60f1 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/Acst/WetarHeaterJinmaoHistoryPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/Acst/WetarHeaterJinmaoHistoryPage.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using HDL_ON.DAL.Server; using HDL_ON.Entity; +using HDL_ON.Stan; using HDL_ON.UI.CSS; using Shared; namespace HDL_ON.UI @@ -19,6 +20,13 @@ Button infoView1_DateInfo_PreClickButton; Button infoView1_DateInfo_DateTextButton; Button infoView1_DateInfo_NextClickButton; + Button infoView1_DateInfo_NextIconButton; + Button infoView1_DateInfo_PreIconButton; + QueryType tempQueryType = QueryType.day_hour; + int tempQueryTime_Day = DateTime.Now.Day; + int tempQueryTime_Month = DateTime.Now.Month; + int tempQueryTime_Year = DateTime.Now.Year; + string tempQueryTimeString = DateTime.Now.ToString("yyyy/MM/dd"); FrameLayout infoView2; @@ -30,6 +38,13 @@ Button infoView2_DateInfo_PreClickButton; Button infoView2_DateInfo_DateTextButton; Button infoView2_DateInfo_NextClickButton; + Button infoView2_DateInfo_NextIconButton; + Button infoView2_DateInfo_PreIconButton; + QueryType waterQueryType = QueryType.day_hour; + int waterQueryTime_Day = DateTime.Now.Day; + int waterQueryTime_Month = DateTime.Now.Month; + int waterQueryTime_Year = DateTime.Now.Year; + string waterQueryTimeString = DateTime.Now.ToString("yyyy/MM/dd"); public WetarHeaterJinmaoHistoryPage(Function deviceFunction) @@ -141,7 +156,7 @@ }; infoView1.AddChidren(infoView1_DateInfoView); - var infoView1_DateInfo_PreIconButton = new Button() + infoView1_DateInfo_PreIconButton = new Button() { X = Application.GetRealWidth(18), Gravity = Gravity.CenterVertical, @@ -162,7 +177,7 @@ Gravity = Gravity.Center, Width = Application.GetRealWidth(200), TextAlignment = TextAlignment.Center, - Text = "2024-8-12", + Text = DateTime.Now.ToString("yyyy-MM-dd"), TextColor = CSS_Color.FirstLevelTitleColor, IsBold = true, TextSize = 16, @@ -170,7 +185,7 @@ infoView1_DateInfoView.AddChidren(infoView1_DateInfo_DateTextButton); - var infoView1_DateInfo_NextIconButton = new Button() + infoView1_DateInfo_NextIconButton = new Button() { X = Application.GetRealWidth(343 - 18 - 6), Gravity = Gravity.CenterVertical, @@ -182,6 +197,7 @@ infoView1_DateInfo_NextClickButton = new Button() { + X = Application.GetRealWidth(343 - 18 - 6 -32), Width = Application.GetRealWidth(32 + 6), }; infoView1_DateInfoView.AddChidren(infoView1_DateInfo_NextClickButton); @@ -346,7 +362,7 @@ }; infoView2.AddChidren(infoView2_DateInfoView); - var infoView2_DateInfo_PreIconButton = new Button() + infoView2_DateInfo_PreIconButton = new Button() { X = Application.GetRealWidth(18), Gravity = Gravity.CenterVertical, @@ -367,14 +383,14 @@ Gravity = Gravity.Center, Width = Application.GetRealWidth(200), TextAlignment = TextAlignment.Center, - Text = "2024-8-12", + Text = DateTime.Now.ToString("yyyy-MM-dd"), TextColor = CSS_Color.FirstLevelTitleColor, IsBold = true, TextSize = 16, }; infoView2_DateInfoView.AddChidren(infoView2_DateInfo_DateTextButton); - var infoView2_DateInfo_NextIconButton = new Button() + infoView2_DateInfo_NextIconButton = new Button() { X = Application.GetRealWidth(343 - 18 - 6), Gravity = Gravity.CenterVertical, @@ -386,6 +402,7 @@ infoView2_DateInfo_NextClickButton = new Button() { + X = Application.GetRealWidth(343 - 18 - 6 -32), Width = Application.GetRealWidth(32 + 6), }; infoView2_DateInfoView.AddChidren(infoView2_DateInfo_NextClickButton); @@ -457,14 +474,22 @@ { Height = Application.GetRealWidth(26) }); + + initQueryButton(); } /// <summary> /// 璇诲彇娓╁害鍊煎巻鍙叉暟鎹� + /// hour=杩�24灏忔椂銆乨ay_hour =鏌愭棩24灏忔椂銆亀eek=杩戜竴鍛ㄣ�乵onth = 杩戜竴鏈堛�乧ustom_month=鏌愬勾鏌愭湀 y/M銆乧ustom_year=鏌愬勾 y /// </summary> - private void getTempHistory(string queryType) + private void getTempHistory() { + if (MainPage.NoLoginMode) + { + return; + } + var loadPage = new Loading() { LodingBackgroundColor = 0x88888888, @@ -480,7 +505,20 @@ loadPage.Start(Language.StringByID(StringId.PleaseWait)); }); - var revertObj = new HttpServerRequest().GetSensorHistory(queryType, function.deviceId, WaterHeaterJinmao_AttrEnum.temp.ToString()); + switch (tempQueryType) + { + case QueryType.day_hour: + tempQueryTimeString = tempQueryTime_Year.ToString() + "/" + tempQueryTime_Month + "/" + tempQueryTime_Day; + break; + case QueryType.custom_month: + tempQueryTimeString = tempQueryTime_Year.ToString() + "/" + tempQueryTime_Month ; + break; + case QueryType.custom_year: + tempQueryTimeString = tempQueryTime_Year.ToString(); + break; + } + + var revertObj = new HttpServerRequest().GetSensorHistory(tempQueryType.ToString(), function.deviceId, WaterHeaterJinmao_AttrEnum.temp.ToString(),tempQueryTimeString); if (revertObj != null) { if (revertObj.Code == StateCode.SUCCESS) @@ -519,9 +557,12 @@ /// <summary> /// 鑾峰彇鐢ㄦ按閲忓巻鍙茶褰� /// </summary> - /// <param name="queryType"></param> - private void getWaterHistory(string queryType) + private void getWaterHistory() { + if (MainPage.NoLoginMode) + { + return; + } var loadPage = new Loading() { LodingBackgroundColor = 0x88888888, @@ -536,8 +577,20 @@ { loadPage.Start(Language.StringByID(StringId.PleaseWait)); }); + switch (waterQueryType) + { + case QueryType.day_hour: + waterQueryTimeString = waterQueryTime_Year.ToString() + "/" + waterQueryTime_Month + "/" + waterQueryTime_Day; + break; + case QueryType.custom_month: + waterQueryTimeString = waterQueryTime_Year.ToString() + "/" + waterQueryTime_Month; + break; + case QueryType.custom_year: + waterQueryTimeString = waterQueryTime_Year.ToString(); + break; + } - var revertObj = new HttpServerRequest().GetSensorHistory(queryType, function.deviceId, WaterHeaterJinmao_AttrEnum.volume.ToString()); + var revertObj = new HttpServerRequest().GetSensorHistory(waterQueryType.ToString(), function.deviceId, WaterHeaterJinmao_AttrEnum.volume.ToString(),waterQueryTimeString); if (revertObj != null) { if (revertObj.Code == StateCode.SUCCESS) @@ -576,6 +629,113 @@ private void initQueryButton() { + infoView1_DateInfo_DateTextButton.MouseUpEventHandler = (sender, e) => + { + SetTempQureyDateDialog(); + }; + infoView1_DateInfo_PreClickButton.MouseUpEventHandler = (sender, e) => { + var tempQueryDate = new DateTime(tempQueryTime_Year,tempQueryTime_Month,tempQueryTime_Day); + if (tempQueryType == QueryType.day_hour) + { + tempQueryDate = tempQueryDate.AddDays(-1); + if(tempQueryDate.Year == 2023 && tempQueryDate.Month == 1 && tempQueryDate.Day == 1) + { + infoView1_DateInfo_PreIconButton.Visible = false; + infoView1_DateInfo_PreClickButton.Enable = false; + } + if (tempQueryDate.Year == DateTime.Now.Year && tempQueryDate.Month == DateTime.Now.Month && tempQueryDate.Day == DateTime.Now.Day - 1) + { + infoView1_DateInfo_NextIconButton.Visible = true; + infoView1_DateInfo_NextClickButton.Enable = true; + } + } + else if(tempQueryType == QueryType.custom_month) + { + tempQueryDate = tempQueryDate.AddMonths(-1); + if (tempQueryDate.Year == 2023 && tempQueryDate.Month == 1) + { + infoView1_DateInfo_PreIconButton.Visible = false; + infoView1_DateInfo_PreClickButton.Enable = false; + } + if (tempQueryDate.Year == DateTime.Now.Year && tempQueryDate.Month == DateTime.Now.Month - 1) + { + infoView1_DateInfo_NextIconButton.Visible = true; + infoView1_DateInfo_NextClickButton.Enable = true; + } + } + else if(tempQueryType == QueryType.custom_year) + { + tempQueryDate = tempQueryDate.AddYears(-1); + if (tempQueryDate.Year == 2023) + { + infoView1_DateInfo_PreIconButton.Visible = false; + infoView1_DateInfo_PreClickButton.Enable = false; + } + if (tempQueryDate.Year == DateTime.Now.Year - 1) + { + infoView1_DateInfo_NextIconButton.Visible = true; + infoView1_DateInfo_NextClickButton.Enable = true; + } + } + tempQueryTime_Year = tempQueryDate.Year; + tempQueryTime_Month = tempQueryDate.Month; + tempQueryTime_Day = tempQueryDate.Day; + infoView1_DateInfo_DateTextButton.Text = tempQueryDate.ToString("yyyy-MM-dd"); + getTempHistory(); + }; + infoView1_DateInfo_NextIconButton.Visible = false; + infoView1_DateInfo_NextClickButton.Enable = false; + infoView1_DateInfo_NextClickButton.MouseUpEventHandler = (sender, e) => { + var tempQueryDate = new DateTime(tempQueryTime_Year, tempQueryTime_Month, tempQueryTime_Day); + if (tempQueryType == QueryType.day_hour) + { + tempQueryDate = tempQueryDate.AddDays(1); + if (tempQueryDate.Year == 2023 && tempQueryDate.Month == 1 && tempQueryDate.Day == 2) + { + infoView1_DateInfo_PreIconButton.Visible = true; + infoView1_DateInfo_PreClickButton.Enable = true; + } + if (tempQueryDate.Year == DateTime.Now.Year && tempQueryDate.Month == DateTime.Now.Month && tempQueryDate.Day == DateTime.Now.Day) + { + infoView1_DateInfo_NextIconButton.Visible = false; + infoView1_DateInfo_NextClickButton.Enable = false; + } + } + else if (tempQueryType == QueryType.custom_month) + { + tempQueryDate = tempQueryDate.AddMonths(1); + if (tempQueryDate.Year == 2023 && tempQueryDate.Month == 2) + { + infoView1_DateInfo_PreIconButton.Visible = true; + infoView1_DateInfo_PreClickButton.Enable = true; + } + if (tempQueryDate.Year == DateTime.Now.Year && tempQueryDate.Month == DateTime.Now.Month ) + { + infoView1_DateInfo_NextIconButton.Visible = false; + infoView1_DateInfo_NextClickButton.Enable = false; + } + } + else if (tempQueryType == QueryType.custom_year) + { + tempQueryDate = tempQueryDate.AddYears(1); + if (tempQueryDate.Year == 2023) + { + infoView1_DateInfo_PreIconButton.Visible = false; + infoView1_DateInfo_PreClickButton.Enable = false; + } + if (tempQueryDate.Year == DateTime.Now.Year) + { + infoView1_DateInfo_NextIconButton.Visible = false; + infoView1_DateInfo_NextClickButton.Enable = false; + } + } + tempQueryTime_Year = tempQueryDate.Year; + tempQueryTime_Month = tempQueryDate.Month; + tempQueryTime_Day = tempQueryDate.Day; + infoView1_DateInfo_DateTextButton.Text = tempQueryDate.ToString("yyyy-MM-dd"); + getTempHistory(); + }; + infoView1_Date_Day.MouseUpEventHandler = (sender, e) => { if (infoView1_Date_Day.IsSelected) { @@ -584,12 +744,723 @@ infoView1_Date_Day.IsSelected = true; infoView1_Date_Month.IsSelected = false; infoView1_Date_Year.IsSelected = false; - //getTempHistory("day") + tempQueryType = QueryType.day_hour; + infoView1_DateInfo_DateTextButton.Text = new DateTime(tempQueryTime_Year, tempQueryTime_Month, tempQueryTime_Day).ToString("yyyy-MM-dd"); + getTempHistory(); + }; + infoView1_Date_Month.MouseUpEventHandler = (sender, e) => { + if (infoView1_Date_Month.IsSelected) + { + return; + } + infoView1_Date_Day.IsSelected = false; + infoView1_Date_Month.IsSelected = true; + infoView1_Date_Year.IsSelected = false; + tempQueryType = QueryType.custom_month; + infoView1_DateInfo_DateTextButton.Text = new DateTime(tempQueryTime_Year, tempQueryTime_Month, tempQueryTime_Day).ToString("yyyy-MM"); + getTempHistory(); + }; + infoView1_Date_Year.MouseUpEventHandler = (sender, e) => { + if (infoView1_Date_Year.IsSelected) + { + return; + } + infoView1_Date_Day.IsSelected = false; + infoView1_Date_Month.IsSelected = false; + infoView1_Date_Year.IsSelected = true; + tempQueryType = QueryType.custom_year; + infoView1_DateInfo_DateTextButton.Text = tempQueryTime_Year.ToString(); + getTempHistory(); + }; + //-----------鐢ㄦ按 + infoView2_DateInfo_DateTextButton.MouseUpEventHandler = (sender, e) => + { + SetWaterQureyDateDialog(); + }; + infoView2_DateInfo_PreClickButton.MouseUpEventHandler = (sender, e) => { + var waterQueryDate = new DateTime(waterQueryTime_Year, waterQueryTime_Month, waterQueryTime_Day); + if (waterQueryType == QueryType.day_hour) + { + waterQueryDate = waterQueryDate.AddDays(-1); + if (waterQueryDate.Year == 2023 && waterQueryDate.Month == 1 && waterQueryDate.Day == 1) + { + infoView2_DateInfo_PreIconButton.Visible = false; + infoView2_DateInfo_PreClickButton.Enable = false; + } + if (waterQueryDate.Year == DateTime.Now.Year && waterQueryDate.Month == DateTime.Now.Month && waterQueryDate.Day == DateTime.Now.Day - 1) + { + infoView2_DateInfo_NextIconButton.Visible = true; + infoView2_DateInfo_NextClickButton.Enable = true; + } + } + else if (waterQueryType == QueryType.custom_month) + { + waterQueryDate = waterQueryDate.AddMonths(-1); + if (waterQueryDate.Year == 2023 && waterQueryDate.Month == 1) + { + infoView2_DateInfo_PreIconButton.Visible = false; + infoView2_DateInfo_PreClickButton.Enable = false; + } + if (waterQueryDate.Year == DateTime.Now.Year && waterQueryDate.Month == DateTime.Now.Month - 1) + { + infoView2_DateInfo_NextIconButton.Visible = true; + infoView2_DateInfo_NextClickButton.Enable = true; + } + } + else if (waterQueryType == QueryType.custom_year) + { + waterQueryDate = waterQueryDate.AddYears(-1); + if (waterQueryDate.Year == 2023) + { + infoView2_DateInfo_PreIconButton.Visible = false; + infoView2_DateInfo_PreClickButton.Enable = false; + } + if (waterQueryDate.Year == DateTime.Now.Year - 1) + { + infoView2_DateInfo_NextIconButton.Visible = true; + infoView2_DateInfo_NextClickButton.Enable = true; + } + } + waterQueryTime_Year = waterQueryDate.Year; + waterQueryTime_Month = waterQueryDate.Month; + waterQueryTime_Day = waterQueryDate.Day; + infoView2_DateInfo_DateTextButton.Text = waterQueryDate.ToString("yyyy-MM-dd"); + getWaterHistory(); + }; + infoView2_DateInfo_NextIconButton.Visible = false; + infoView2_DateInfo_NextClickButton.Enable = false; + infoView2_DateInfo_NextClickButton.MouseUpEventHandler = (sender, e) => { + var waterQueryDate = new DateTime(waterQueryTime_Year, waterQueryTime_Month, waterQueryTime_Day); + if (waterQueryType == QueryType.day_hour) + { + waterQueryDate = waterQueryDate.AddDays(1); + if (waterQueryDate.Year == 2023 && waterQueryDate.Month == 1 && waterQueryDate.Day == 2) + { + infoView2_DateInfo_PreIconButton.Visible = true; + infoView2_DateInfo_PreClickButton.Enable = true; + } + if (waterQueryDate.Year == DateTime.Now.Year && waterQueryDate.Month == DateTime.Now.Month && waterQueryDate.Day == DateTime.Now.Day) + { + infoView2_DateInfo_NextIconButton.Visible = false; + infoView2_DateInfo_NextClickButton.Enable = false; + } + } + else if (waterQueryType == QueryType.custom_month) + { + waterQueryDate = waterQueryDate.AddMonths(1); + if (waterQueryDate.Year == 2023 && waterQueryDate.Month == 2) + { + infoView2_DateInfo_PreIconButton.Visible = true; + infoView2_DateInfo_PreClickButton.Enable = true; + } + if (waterQueryDate.Year == DateTime.Now.Year && waterQueryDate.Month == DateTime.Now.Month) + { + infoView2_DateInfo_NextIconButton.Visible = false; + infoView2_DateInfo_NextClickButton.Enable = false; + } + } + else if (waterQueryType == QueryType.custom_year) + { + waterQueryDate = waterQueryDate.AddYears(1); + if (waterQueryDate.Year == 2023) + { + infoView2_DateInfo_PreIconButton.Visible = false; + infoView2_DateInfo_PreClickButton.Enable = false; + } + if (waterQueryDate.Year == DateTime.Now.Year) + { + infoView2_DateInfo_NextIconButton.Visible = false; + infoView2_DateInfo_NextClickButton.Enable = false; + } + } + waterQueryTime_Year = waterQueryDate.Year; + waterQueryTime_Month = waterQueryDate.Month; + waterQueryTime_Day = waterQueryDate.Day; + infoView2_DateInfo_DateTextButton.Text = waterQueryDate.ToString("yyyy-MM-dd"); + getWaterHistory(); + }; + infoView2_Date_Day.MouseDownEventHandler = (sender, e) => { + if (infoView2_Date_Day.IsSelected) + { + return; + } + infoView2_Date_Day.IsSelected = true; + infoView2_Date_Month.IsSelected = false; + infoView2_Date_Year.IsSelected = false; + waterQueryType = QueryType.day_hour; + infoView2_DateInfo_DateTextButton.Text = new DateTime(waterQueryTime_Year, waterQueryTime_Month, waterQueryTime_Day).ToString("yyyy-MM-dd"); + getWaterHistory(); + }; + infoView2_Date_Month.MouseDownEventHandler = (sender, e) => { + if (infoView2_Date_Month.IsSelected) + { + return; + } + infoView2_Date_Day.IsSelected = false; + infoView2_Date_Month.IsSelected = true; + infoView2_Date_Year.IsSelected = false; + waterQueryType = QueryType.custom_month; + infoView2_DateInfo_DateTextButton.Text = new DateTime(waterQueryTime_Year, waterQueryTime_Month, waterQueryTime_Day).ToString("yyyy-MM"); + getWaterHistory(); + }; + infoView2_Date_Year.MouseDownEventHandler = (sender, e) => { + if (infoView2_Date_Year.IsSelected) + { + return; + } + infoView2_Date_Day.IsSelected = false; + infoView2_Date_Month.IsSelected = false; + infoView2_Date_Year.IsSelected = true; + waterQueryType = QueryType.custom_year; + infoView2_DateInfo_DateTextButton.Text = waterQueryTime_Year.ToString(); + getWaterHistory(); + }; + + } + + /// <summary> + /// </summary> + public void SetTempQureyDateDialog() + { + var pickerItems_Year = new List<string>(); + List<string> pickerItems_Month = null; + List<string> pickerItems_Day = null; + + int item1 = tempQueryTime_Year; + int item2 = tempQueryTime_Month; + int item3 = tempQueryTime_Day; + + pickerItems_Year.Add("2023"); + while (DateTime.Now.Year > 2022 + pickerItems_Year.Count) + { + pickerItems_Year.Add((2023 + pickerItems_Year.Count).ToString()); + } + + if(tempQueryType == QueryType.custom_month || tempQueryType == QueryType.day_hour) + { + pickerItems_Month = new List<string>(); + if (tempQueryTime_Year == DateTime.Now.Year) + { + int addMonth = 0; + while (DateTime.Now.Month > addMonth) + { + addMonth++; + pickerItems_Month.Add(addMonth.ToString()); + } + } + else + { + for (var i = 1; i < 13; i++) + { + pickerItems_Month.Add(i.ToString()); + } + } + if (tempQueryType == QueryType.day_hour) + { + pickerItems_Day = new List<string>(); + if (tempQueryTime_Month == DateTime.Now.Month) + { + int addDay = 0; + while (DateTime.Now.Day > addDay) + { + addDay++; + pickerItems_Day.Add(addDay.ToString()); + } + } + else + { + for (var i = 1; i <= DateTime.DaysInMonth(tempQueryTime_Year, tempQueryTime_Month); i++) + { + pickerItems_Day.Add(i.ToString()); + } + } + } + } + + Dialog dialog = new Dialog(); + + var pView = new FrameLayout() + { + BackgroundColor = CSS_Color.DialogTransparentColor1, + }; + dialog.AddChidren(pView); + + var optionBaseView = new FrameLayout() + { + Y = Application.GetRealHeight(456 - 60), + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(343), + Height = Application.GetRealHeight(260), + AnimateSpeed = 0.3f, + Animate = Animate.DownToUp, + BackgroundColor = CSS_Color.MainBackgroundColor, + Radius = (uint)Application.GetRealWidth(12), + }; + pView.AddChidren(optionBaseView); + + var topView = new FrameLayout() + { + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(343), + Height = Application.GetRealHeight(40), + BackgroundColor = CSS_Color.MainBackgroundColor, + Radius = (uint)Application.GetRealWidth(12), + }; + optionBaseView.AddChidren(topView); + topView.AddChidren(new Button() { Y = Application.GetRealHeight(39), Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor }); + + var btnCancel = new Button() + { + X = Application.GetRealWidth(21), + Width = Application.GetRealWidth(100), + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.PromptingColor1, + TextSize = CSS_FontSize.TextFontSize, + TextID = StringId.Cancel, + }; + topView.AddChidren(btnCancel); + + var btnConfrim = new Button() + { + X = Application.GetRealWidth(160), + Width = Application.GetRealWidth(160), + TextAlignment = TextAlignment.CenterRight, + TextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.TextFontSize, + TextID = StringId.Confirm, + }; + topView.AddChidren(btnConfrim); + + UIPickerView uIPickerView = new UIPickerView() + { + Y = Application.GetRealHeight(40), + Height = Application.GetRealHeight(210), + Radius = (uint)Application.GetRealWidth(12), + }; + optionBaseView.AddChidren(uIPickerView); + uIPickerView.setNPicker(pickerItems_Year, pickerItems_Month, pickerItems_Day); + uIPickerView.setCurrentItems(pickerItems_Year.IndexOf(tempQueryTime_Year.ToString()), + pickerItems_Month == null ? 0: pickerItems_Month.IndexOf(tempQueryTime_Month.ToString()), + pickerItems_Day == null? 0: pickerItems_Day.IndexOf(tempQueryTime_Day.ToString())); + + dialog.Show(); + + pView.MouseUpEventHandler = (sender, e) => + { + dialog.Close(); + }; + + btnCancel.MouseUpEventHandler = (sender, e) => + { + dialog.Close(); + }; + uIPickerView.OnSelectChangeEvent = (int1, int2, int3) => + { + if (pickerItems_Year[int1] != item1.ToString()) + { + int.TryParse(pickerItems_Year[int1], out item1); + if (tempQueryType == QueryType.custom_month || tempQueryType == QueryType.day_hour) + { + pickerItems_Month = new List<string>(); + if (item1 == DateTime.Now.Year) + { + int addMonth = 0; + while (DateTime.Now.Month > addMonth) + { + addMonth++; + pickerItems_Month.Add(addMonth.ToString()); + } + } + else + { + for (var i = 1; i < 13; i++) + { + pickerItems_Month.Add(i.ToString()); + } + } + if (tempQueryType == QueryType.day_hour) + { + pickerItems_Day = new List<string>(); + if (item1 == DateTime.Now.Year && item2 == DateTime.Now.Month) + { + int addDay = 0; + while (DateTime.Now.Day > addDay) + { + addDay++; + pickerItems_Day.Add(addDay.ToString()); + } + } + else + { + for (var i = 1; i <= DateTime.DaysInMonth(item1, item2); i++) + { + pickerItems_Day.Add(i.ToString()); + } + } + } + } + uIPickerView.setNPicker(pickerItems_Year, pickerItems_Month, pickerItems_Day); + uIPickerView.setCurrentItems(pickerItems_Year.IndexOf(item1.ToString()), + pickerItems_Month == null ? 0 : pickerItems_Month.IndexOf(item2.ToString()), + pickerItems_Day == null ? 0 : pickerItems_Day.IndexOf(item3.ToString())); + + } + if (pickerItems_Month != null) + { + if (pickerItems_Month[int2] != item2.ToString()) + { + int.TryParse(pickerItems_Month[int2], out item2); + if (tempQueryType == QueryType.day_hour) + { + pickerItems_Day = new List<string>(); + if (item1 == DateTime.Now.Year && item2 == DateTime.Now.Month) + { + int addDay = 0; + while (DateTime.Now.Day > addDay) + { + addDay++; + pickerItems_Day.Add(addDay.ToString()); + } + } + else + { + for (var i = 1; i <= DateTime.DaysInMonth(item1, item2); i++) + { + pickerItems_Day.Add(i.ToString()); + } + } + } + + uIPickerView.setNPicker(pickerItems_Year, pickerItems_Month, pickerItems_Day); + uIPickerView.setCurrentItems(pickerItems_Year.IndexOf(item1.ToString()), + pickerItems_Month == null ? 0 : pickerItems_Month.IndexOf(item2.ToString()), + pickerItems_Day == null ? 0 : pickerItems_Day.IndexOf(item3.ToString())); + } + } + if (pickerItems_Day != null) + { + if (int3 >= pickerItems_Day.Count) + { + int3 = 0; + } + if (pickerItems_Day[int3] != item3.ToString()) + { + int.TryParse(pickerItems_Day[int3], out item3); + } + } + }; + btnConfrim.MouseUpEventHandler = (sender, e) => + { + dialog.Close(); + tempQueryTime_Year = item1; + infoView1_DateInfo_DateTextButton.Text = tempQueryTime_Year.ToString(); + if (tempQueryType == QueryType.custom_month || tempQueryType == QueryType.day_hour) + { + if (item2 != tempQueryTime_Month) + { + tempQueryTime_Month = item2; + } + infoView1_DateInfo_DateTextButton.Text = new DateTime(tempQueryTime_Year, tempQueryTime_Month, tempQueryTime_Day).ToString("yyyy-MM"); + if (tempQueryType == QueryType.day_hour) + { + if (item3 != tempQueryTime_Day) + { + tempQueryTime_Day = item3; + } + infoView1_DateInfo_DateTextButton.Text = new DateTime(tempQueryTime_Year, tempQueryTime_Month, tempQueryTime_Day).ToString("yyyy-MM-dd"); + } + } + getTempHistory(); + }; + + } + + public void SetWaterQureyDateDialog() + { + var pickerItems_Year = new List<string>(); + List<string> pickerItems_Month = null; + List<string> pickerItems_Day = null; + + int item1 = waterQueryTime_Year; + int item2 = waterQueryTime_Month; + int item3 = waterQueryTime_Day; + + pickerItems_Year.Add("2023"); + while (DateTime.Now.Year > 2022 + pickerItems_Year.Count) + { + pickerItems_Year.Add((2023 + pickerItems_Year.Count).ToString()); + } + + if (waterQueryType == QueryType.custom_month || waterQueryType == QueryType.day_hour) + { + pickerItems_Month = new List<string>(); + if (waterQueryTime_Year == DateTime.Now.Year) + { + int addMonth = 0; + while (DateTime.Now.Month > addMonth) + { + addMonth++; + pickerItems_Month.Add(addMonth.ToString()); + } + } + else + { + for (var i = 1; i < 13; i++) + { + pickerItems_Month.Add(i.ToString()); + } + } + if (waterQueryType == QueryType.day_hour) + { + pickerItems_Day = new List<string>(); + if (waterQueryTime_Month == DateTime.Now.Month) + { + int addDay = 0; + while (DateTime.Now.Day > addDay) + { + addDay++; + pickerItems_Day.Add(addDay.ToString()); + } + } + else + { + for (var i = 1; i <= DateTime.DaysInMonth(waterQueryTime_Year, waterQueryTime_Month); i++) + { + pickerItems_Day.Add(i.ToString()); + } + } + } + } + + Dialog dialog = new Dialog(); + + var pView = new FrameLayout() + { + BackgroundColor = CSS_Color.DialogTransparentColor1, + }; + dialog.AddChidren(pView); + + var optionBaseView = new FrameLayout() + { + Y = Application.GetRealHeight(456 - 60), + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(343), + Height = Application.GetRealHeight(260), + AnimateSpeed = 0.3f, + Animate = Animate.DownToUp, + BackgroundColor = CSS_Color.MainBackgroundColor, + Radius = (uint)Application.GetRealWidth(12), + }; + pView.AddChidren(optionBaseView); + + var topView = new FrameLayout() + { + Gravity = Gravity.CenterHorizontal, + Width = Application.GetRealWidth(343), + Height = Application.GetRealHeight(40), + BackgroundColor = CSS_Color.MainBackgroundColor, + Radius = (uint)Application.GetRealWidth(12), + }; + optionBaseView.AddChidren(topView); + topView.AddChidren(new Button() { Y = Application.GetRealHeight(39), Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor }); + + var btnCancel = new Button() + { + X = Application.GetRealWidth(21), + Width = Application.GetRealWidth(100), + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.PromptingColor1, + TextSize = CSS_FontSize.TextFontSize, + TextID = StringId.Cancel, + }; + topView.AddChidren(btnCancel); + + var btnConfrim = new Button() + { + X = Application.GetRealWidth(160), + Width = Application.GetRealWidth(160), + TextAlignment = TextAlignment.CenterRight, + TextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.TextFontSize, + TextID = StringId.Confirm, + }; + topView.AddChidren(btnConfrim); + + UIPickerView uIPickerView = new UIPickerView() + { + Y = Application.GetRealHeight(40), + Height = Application.GetRealHeight(210), + Radius = (uint)Application.GetRealWidth(12), + }; + optionBaseView.AddChidren(uIPickerView); + uIPickerView.setNPicker(pickerItems_Year, pickerItems_Month, pickerItems_Day); + uIPickerView.setCurrentItems(pickerItems_Year.IndexOf(waterQueryTime_Year.ToString()), + pickerItems_Month == null ? 0 : pickerItems_Month.IndexOf(waterQueryTime_Month.ToString()), + pickerItems_Day == null ? 0 : pickerItems_Day.IndexOf(waterQueryTime_Day.ToString())); + + dialog.Show(); + + pView.MouseUpEventHandler = (sender, e) => + { + dialog.Close(); + }; + + btnCancel.MouseUpEventHandler = (sender, e) => + { + dialog.Close(); + }; + uIPickerView.OnSelectChangeEvent = (int1, int2, int3) => + { + if (pickerItems_Year[int1] != item1.ToString()) + { + int.TryParse(pickerItems_Year[int1], out item1); + if (waterQueryType == QueryType.custom_month || waterQueryType == QueryType.day_hour) + { + pickerItems_Month = new List<string>(); + if (item1 == DateTime.Now.Year) + { + int addMonth = 0; + while (DateTime.Now.Month > addMonth) + { + addMonth++; + pickerItems_Month.Add(addMonth.ToString()); + } + } + else + { + for (var i = 1; i < 13; i++) + { + pickerItems_Month.Add(i.ToString()); + } + } + if (waterQueryType == QueryType.day_hour) + { + pickerItems_Day = new List<string>(); + if (item1 == DateTime.Now.Year && item2 == DateTime.Now.Month) + { + int addDay = 0; + while (DateTime.Now.Day > addDay) + { + addDay++; + pickerItems_Day.Add(addDay.ToString()); + } + } + else + { + for (var i = 1; i <= DateTime.DaysInMonth(item1, item2); i++) + { + pickerItems_Day.Add(i.ToString()); + } + } + } + } + uIPickerView.setNPicker(pickerItems_Year, pickerItems_Month, pickerItems_Day); + uIPickerView.setCurrentItems(pickerItems_Year.IndexOf(item1.ToString()), + pickerItems_Month == null ? 0 : pickerItems_Month.IndexOf(item2.ToString()), + pickerItems_Day == null ? 0 : pickerItems_Day.IndexOf(item3.ToString())); + + } + if (pickerItems_Month != null) + { + if (pickerItems_Month[int2] != item2.ToString()) + { + int.TryParse(pickerItems_Month[int2], out item2); + if (waterQueryType == QueryType.day_hour) + { + pickerItems_Day = new List<string>(); + if (item1 == DateTime.Now.Year && item2 == DateTime.Now.Month) + { + int addDay = 0; + while (DateTime.Now.Day > addDay) + { + addDay++; + pickerItems_Day.Add(addDay.ToString()); + } + } + else + { + for (var i = 1; i <= DateTime.DaysInMonth(item1, item2); i++) + { + pickerItems_Day.Add(i.ToString()); + } + } + } + + uIPickerView.setNPicker(pickerItems_Year, pickerItems_Month, pickerItems_Day); + uIPickerView.setCurrentItems(pickerItems_Year.IndexOf(item1.ToString()), + pickerItems_Month == null ? 0 : pickerItems_Month.IndexOf(item2.ToString()), + pickerItems_Day == null ? 0 : pickerItems_Day.IndexOf(item3.ToString())); + } + } + if (pickerItems_Day != null) + { + if (int3 >= pickerItems_Day.Count) + { + int3 = 0; + } + if (pickerItems_Day[int3] != item3.ToString()) + { + int.TryParse(pickerItems_Day[int3], out item3); + } + } + }; + btnConfrim.MouseUpEventHandler = (sender, e) => + { + dialog.Close(); + waterQueryTime_Year = item1; + infoView2_DateInfo_DateTextButton.Text = waterQueryTime_Year.ToString(); + if (waterQueryType == QueryType.custom_month || waterQueryType == QueryType.day_hour) + { + if (item2 != waterQueryTime_Month) + { + waterQueryTime_Month = item2; + } + infoView2_DateInfo_DateTextButton.Text = new DateTime(waterQueryTime_Year, waterQueryTime_Month, waterQueryTime_Day).ToString("yyyy-MM"); + if (waterQueryType == QueryType.day_hour) + { + if (item3 != waterQueryTime_Day) + { + waterQueryTime_Day = item3; + } + infoView2_DateInfo_DateTextButton.Text = new DateTime(waterQueryTime_Year, waterQueryTime_Month, waterQueryTime_Day).ToString("yyyy-MM-dd"); + } + } + getWaterHistory(); }; } + + + } + + public enum QueryType + { + /// <summary> + /// 杩�24灏忔椂銆� + /// </summary> + hour, + /// <summary> + /// 鏌愭棩24灏忔椂銆� + /// </summary> + day_hour, + /// <summary> + /// 杩戜竴鍛ㄣ�� + /// </summary> + week, + /// <summary> + /// 杩戜竴鏈堛�� + /// </summary> + month, + /// <summary> + /// 鏌愬勾鏌愭湀 y/M銆� + /// </summary> + custom_month, + /// <summary> + /// 鏌愬勾 y + /// </summary> + custom_year, } } diff --git a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EchartsOption_Histogram.cs b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EchartsOption_Histogram.cs index 3bfd3af..f0b6aeb 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EchartsOption_Histogram.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EchartsOption_Histogram.cs @@ -72,6 +72,72 @@ return YvalueText; } +#if __ANDROID__ + public string optionString = @"{ + grid: { + top: '10%', + left: '15%', + right: '15%', + bottom: '10%', + }, + xAxis: { + data: [{xData}], + axisTick: { + show: false + }, + axisLine: { + show: false + }, + name:'{xName}', + nameGap:5, + nameTextStyle:{ + color:'#7C8590', + fontSize:10 + }, + axisLabel: { + color: '#7C8590', + fontSize:10 + } + }, + yAxis: { + name:'{yName}', + nameGap:12, + nameTextStyle:{ + color:'#030D1C', + fontSize:10 + }, + axisLine: { + show: false + }, + axisTick: { + show: false + }, + axisLabel: { + color: '#7C8590', + fontSize:10 + } + }, + dataZoom: [ + { + type: 'inside' + } + ], + series: [ + { + type: 'bar', + showBackground: false, + itemStyle: { + color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ + { offset: 0, color: '#6AB7F9' }, + { offset: 0.5, color: '#5AA6FF' }, + { offset: 1, color: '#6B97F9' } + ]) + }, + data: [{yData}] + } + ] + }"; +#else public string optionString = @"{ grid: { @@ -136,7 +202,7 @@ } ] }"; - +#endif } -- Gitblit v1.8.0