From b562a582ac3a288193e6e4f57c5eff8a344305a4 Mon Sep 17 00:00:00 2001
From: wxr <wxr@hdlchina.com.cn>
Date: 星期五, 27 九月 2024 13:52:17 +0800
Subject: [PATCH] Update AndroidManifest.xml
---
HDL_ON/UI/UI2/FuntionControlView/Acst/InverterJinmaoHistroyPage.cs | 906 +++++++++++++++++++++++++++++++------------------------
1 files changed, 511 insertions(+), 395 deletions(-)
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Acst/InverterJinmaoHistroyPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Acst/InverterJinmaoHistroyPage.cs
index 119e878..504de37 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Acst/InverterJinmaoHistroyPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Acst/InverterJinmaoHistroyPage.cs
@@ -48,15 +48,11 @@
string queryTimeString2 = DateTime.Now.ToString("yyyy/MM/dd");
- /// <summary>
- /// echart瀹瑰櫒
- /// </summary>
- MyEchartsViewOn tempEchartsView;
-
public InverterJinmaoHistroyPage(Function deviceFunction)
{
bodyView = this;
function = deviceFunction;
+ BackgroundColor = CSS_Color.BackgroundColor;
}
public void LoadPage()
@@ -73,7 +69,7 @@
bodyView.AddChidren(contentView);
#region 鍙戠數閲�
- var infoView1 = new FrameLayout()
+ infoView1 = new FrameLayout()
{
Width = Application.GetRealWidth(343),
Height = Application.GetRealWidth(382),
@@ -100,7 +96,7 @@
};
infoView1.AddChidren(infoView1_DateView);
- var infoView1_Date_Day = new Button()
+ infoView1_Date_Day = new Button()
{
Width = Application.GetRealWidth(103),
Height = Application.GetRealWidth(26),
@@ -119,7 +115,7 @@
infoView1_DateView.AddChidren(infoView1_Date_Day);
- var infoView1_Date_Month = new Button()
+ infoView1_Date_Month = new Button()
{
Width = Application.GetRealWidth(103),
Height = Application.GetRealWidth(26),
@@ -138,7 +134,7 @@
infoView1_DateView.AddChidren(infoView1_Date_Month);
- var infoView1_Date_Year = new Button()
+ infoView1_Date_Year = new Button()
{
Width = Application.GetRealWidth(103),
Height = Application.GetRealWidth(26),
@@ -163,7 +159,7 @@
};
infoView1.AddChidren(infoView1_DateInfoView);
- var infoView1_DateInfo_PreIconButton = new Button()
+ infoView1_DateInfo_PreIconButton = new Button()
{
X = Application.GetRealWidth(18),
Gravity = Gravity.CenterVertical,
@@ -173,13 +169,13 @@
};
infoView1_DateInfoView.AddChidren(infoView1_DateInfo_PreIconButton);
- var infoView1_DateInfo_PreClickButton = new Button()
+ infoView1_DateInfo_PreClickButton = new Button()
{
Width = Application.GetRealWidth(32 + 6),
};
infoView1_DateInfoView.AddChidren(infoView1_DateInfo_PreClickButton);
- var infoView1_DateInfo_DateTextButton = new Button()
+ infoView1_DateInfo_DateTextButton = new Button()
{
Gravity = Gravity.Center,
Width = Application.GetRealWidth(200),
@@ -192,7 +188,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,
@@ -202,9 +198,9 @@
};
infoView1_DateInfoView.AddChidren(infoView1_DateInfo_NextIconButton);
- var infoView1_DateInfo_NextClickButton = new Button()
+ infoView1_DateInfo_NextClickButton = new Button()
{
- X = Application.GetRealWidth(343 - 18 - 6 -32),
+ X = Application.GetRealWidth(343 - 18 - 6 - 32),
Width = Application.GetRealWidth(32 + 6),
};
infoView1_DateInfoView.AddChidren(infoView1_DateInfo_NextClickButton);
@@ -212,50 +208,50 @@
#endregion
#region 鏁版嵁鍥捐〃
- MyEchartsViewOn infoView1_EchartsView = new MyEchartsViewOn()
+ infoView1_EchartsView = new MyEchartsViewOn()
{
Y = Application.GetRealWidth(101),
Height = Application.GetRealWidth(246),
};
infoView1.AddChidren(infoView1_EchartsView);
- var echartOption = new EchartsOption_Histogram();
- echartOption.xTitle = "鏃堕棿";
- echartOption.yTitle = "鐢甸噺锛坘w锛�";
- echartOption.InitXdataText(new List<string>()
- {
- "21","22","23","24","25","26","26","27","28","29",
- "21","22","23","24","25","26","26","27","28","29",
- "21","22","23","24"
- });
- echartOption.InitYdataText(new List<EnvironmentalSensorHistor>() {
- new EnvironmentalSensorHistor{ fieldName = "1", fieldValue= "23" },
- new EnvironmentalSensorHistor{ fieldName = "2", fieldValue= "22" },
- new EnvironmentalSensorHistor{ fieldName = "3", fieldValue= "11" },
- new EnvironmentalSensorHistor{ fieldName = "4", fieldValue= "21" },
- new EnvironmentalSensorHistor{ fieldName = "5", fieldValue= "41" },
- new EnvironmentalSensorHistor{ fieldName = "6", fieldValue= "23" },
- new EnvironmentalSensorHistor{ fieldName = "7", fieldValue= "31" },
- new EnvironmentalSensorHistor{ fieldName = "8", fieldValue= "23" },
- new EnvironmentalSensorHistor{ fieldName = "9", fieldValue= "11" },
- new EnvironmentalSensorHistor{ fieldName = "10", fieldValue= "21" },
- new EnvironmentalSensorHistor{ fieldName = "11", fieldValue= "24" },
- new EnvironmentalSensorHistor{ fieldName = "12", fieldValue= "41" },
- new EnvironmentalSensorHistor{ fieldName = "13", fieldValue= "32" },
- new EnvironmentalSensorHistor{ fieldName = "14", fieldValue= "23" },
- new EnvironmentalSensorHistor{ fieldName = "15", fieldValue= "23" },
- new EnvironmentalSensorHistor{ fieldName = "16", fieldValue= "22" },
- new EnvironmentalSensorHistor{ fieldName = "17", fieldValue= "11" },
- new EnvironmentalSensorHistor{ fieldName = "18", fieldValue= "21" },
- new EnvironmentalSensorHistor{ fieldName = "19", fieldValue= "41" },
- new EnvironmentalSensorHistor{ fieldName = "20", fieldValue= "23" },
- new EnvironmentalSensorHistor{ fieldName = "21", fieldValue= "31" },
- new EnvironmentalSensorHistor{ fieldName = "22", fieldValue= "23" },
- new EnvironmentalSensorHistor{ fieldName = "23", fieldValue= "11" },
- new EnvironmentalSensorHistor{ fieldName = "24", fieldValue= "21" },
- });
- var ddd = echartOption.InitOption();
- infoView1_EchartsView.ShowWithOption(ddd);
+ echartOption1 = new EchartsOption_Histogram();
+ echartOption1.xTitle = "鏃堕棿";
+ echartOption1.yTitle = "鐢甸噺锛坘wh锛�";
+ //echartOption.InitXdataText(new List<string>()
+ //{
+ // "21","22","23","24","25","26","26","27","28","29",
+ // "21","22","23","24","25","26","26","27","28","29",
+ // "21","22","23","24"
+ //});
+ //echartOption.InitYdataText(new List<EnvironmentalSensorHistor>() {
+ // new EnvironmentalSensorHistor{ fieldName = "1", fieldValue= "23" },
+ // new EnvironmentalSensorHistor{ fieldName = "2", fieldValue= "22" },
+ // new EnvironmentalSensorHistor{ fieldName = "3", fieldValue= "11" },
+ // new EnvironmentalSensorHistor{ fieldName = "4", fieldValue= "21" },
+ // new EnvironmentalSensorHistor{ fieldName = "5", fieldValue= "41" },
+ // new EnvironmentalSensorHistor{ fieldName = "6", fieldValue= "23" },
+ // new EnvironmentalSensorHistor{ fieldName = "7", fieldValue= "31" },
+ // new EnvironmentalSensorHistor{ fieldName = "8", fieldValue= "23" },
+ // new EnvironmentalSensorHistor{ fieldName = "9", fieldValue= "11" },
+ // new EnvironmentalSensorHistor{ fieldName = "10", fieldValue= "21" },
+ // new EnvironmentalSensorHistor{ fieldName = "11", fieldValue= "24" },
+ // new EnvironmentalSensorHistor{ fieldName = "12", fieldValue= "41" },
+ // new EnvironmentalSensorHistor{ fieldName = "13", fieldValue= "32" },
+ // new EnvironmentalSensorHistor{ fieldName = "14", fieldValue= "23" },
+ // new EnvironmentalSensorHistor{ fieldName = "15", fieldValue= "23" },
+ // new EnvironmentalSensorHistor{ fieldName = "16", fieldValue= "22" },
+ // new EnvironmentalSensorHistor{ fieldName = "17", fieldValue= "11" },
+ // new EnvironmentalSensorHistor{ fieldName = "18", fieldValue= "21" },
+ // new EnvironmentalSensorHistor{ fieldName = "19", fieldValue= "41" },
+ // new EnvironmentalSensorHistor{ fieldName = "20", fieldValue= "23" },
+ // new EnvironmentalSensorHistor{ fieldName = "21", fieldValue= "31" },
+ // new EnvironmentalSensorHistor{ fieldName = "22", fieldValue= "23" },
+ // new EnvironmentalSensorHistor{ fieldName = "23", fieldValue= "11" },
+ // new EnvironmentalSensorHistor{ fieldName = "24", fieldValue= "21" },
+ //});
+ //var ddd = echartOption.InitOption();
+ //infoView1_EchartsView.ShowWithOption(ddd);
infoView1.AddChidren(new Button()
{
@@ -277,7 +273,7 @@
});
#region 鐢ㄧ數閲�
- var infoView2 = new FrameLayout()
+ infoView2 = new FrameLayout()
{
Width = Application.GetRealWidth(343),
Height = Application.GetRealWidth(382),
@@ -305,7 +301,7 @@
};
infoView2.AddChidren(infoView2_DateView);
- var infoView2_Date_Day = new Button()
+ infoView2_Date_Day = new Button()
{
Width = Application.GetRealWidth(103),
Height = Application.GetRealWidth(26),
@@ -324,7 +320,7 @@
infoView2_DateView.AddChidren(infoView2_Date_Day);
- var infoView2_Date_Month = new Button()
+ infoView2_Date_Month = new Button()
{
Width = Application.GetRealWidth(103),
Height = Application.GetRealWidth(26),
@@ -343,7 +339,7 @@
infoView2_DateView.AddChidren(infoView2_Date_Month);
- var infoView2_Date_Year = new Button()
+ infoView2_Date_Year = new Button()
{
Width = Application.GetRealWidth(103),
Height = Application.GetRealWidth(26),
@@ -368,7 +364,7 @@
};
infoView2.AddChidren(infoView2_DateInfoView);
- var infoView2_DateInfo_PreIconButton = new Button()
+ infoView2_DateInfo_PreIconButton = new Button()
{
X = Application.GetRealWidth(18),
Gravity = Gravity.CenterVertical,
@@ -378,13 +374,13 @@
};
infoView2_DateInfoView.AddChidren(infoView2_DateInfo_PreIconButton);
- var infoView2_DateInfo_PreClickButton = new Button()
+ infoView2_DateInfo_PreClickButton = new Button()
{
Width = Application.GetRealWidth(32 + 6),
};
infoView2_DateInfoView.AddChidren(infoView2_DateInfo_PreClickButton);
- var infoView2_DateInfo_DateTextButton = new Button()
+ infoView2_DateInfo_DateTextButton = new Button()
{
Gravity = Gravity.Center,
Width = Application.GetRealWidth(200),
@@ -397,7 +393,7 @@
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,
@@ -407,9 +403,9 @@
};
infoView2_DateInfoView.AddChidren(infoView2_DateInfo_NextIconButton);
- var infoView2_DateInfo_NextClickButton = new Button()
+ infoView2_DateInfo_NextClickButton = new Button()
{
- X = Application.GetRealWidth(343 - 18 - 6 -32),
+ X = Application.GetRealWidth(343 - 18 - 6 - 32),
Width = Application.GetRealWidth(32 + 6),
};
infoView2_DateInfoView.AddChidren(infoView2_DateInfo_NextClickButton);
@@ -417,49 +413,49 @@
#endregion
#region 鏁版嵁鍥捐〃
- MyEchartsViewOn infoView2_EchartsView = new MyEchartsViewOn()
+ infoView2_EchartsView = new MyEchartsViewOn()
{
Y = Application.GetRealWidth(101),
Height = Application.GetRealWidth(246),
};
infoView2.AddChidren(infoView2_EchartsView);
- var echartOption2 = new EchartsOption_Histogram();
+ echartOption2 = new EchartsOption_Histogram();
echartOption2.xTitle = "鏃堕棿";
- echartOption2.yTitle = "鐢甸噺锛坘w锛�";
- echartOption2.InitXdataText(new List<string>()
- {
- "21","22","23","24","25","26","26","27","28","29",
- "21","22","23","24","25","26","26","27","28","29",
- "21","22","23","24"
- });
- echartOption2.InitYdataText(new List<EnvironmentalSensorHistor>() {
- new EnvironmentalSensorHistor{ fieldName = "1", fieldValue= "23" },
- new EnvironmentalSensorHistor{ fieldName = "2", fieldValue= "22" },
- new EnvironmentalSensorHistor{ fieldName = "3", fieldValue= "11" },
- new EnvironmentalSensorHistor{ fieldName = "4", fieldValue= "21" },
- new EnvironmentalSensorHistor{ fieldName = "5", fieldValue= "41" },
- new EnvironmentalSensorHistor{ fieldName = "6", fieldValue= "23" },
- new EnvironmentalSensorHistor{ fieldName = "7", fieldValue= "31" },
- new EnvironmentalSensorHistor{ fieldName = "8", fieldValue= "23" },
- new EnvironmentalSensorHistor{ fieldName = "9", fieldValue= "11" },
- new EnvironmentalSensorHistor{ fieldName = "10", fieldValue= "21" },
- new EnvironmentalSensorHistor{ fieldName = "11", fieldValue= "24" },
- new EnvironmentalSensorHistor{ fieldName = "12", fieldValue= "41" },
- new EnvironmentalSensorHistor{ fieldName = "13", fieldValue= "32" },
- new EnvironmentalSensorHistor{ fieldName = "14", fieldValue= "23" },
- new EnvironmentalSensorHistor{ fieldName = "15", fieldValue= "23" },
- new EnvironmentalSensorHistor{ fieldName = "16", fieldValue= "22" },
- new EnvironmentalSensorHistor{ fieldName = "17", fieldValue= "11" },
- new EnvironmentalSensorHistor{ fieldName = "18", fieldValue= "21" },
- new EnvironmentalSensorHistor{ fieldName = "19", fieldValue= "41" },
- new EnvironmentalSensorHistor{ fieldName = "20", fieldValue= "23" },
- new EnvironmentalSensorHistor{ fieldName = "21", fieldValue= "31" },
- new EnvironmentalSensorHistor{ fieldName = "22", fieldValue= "23" },
- new EnvironmentalSensorHistor{ fieldName = "23", fieldValue= "11" },
- new EnvironmentalSensorHistor{ fieldName = "24", fieldValue= "21" },
- });
- infoView2_EchartsView.ShowWithOption(echartOption2.InitOption());
+ echartOption2.yTitle = "鐢甸噺锛坘wh锛�";
+ //echartOption2.InitXdataText(new List<string>()
+ //{
+ // "21","22","23","24","25","26","26","27","28","29",
+ // "21","22","23","24","25","26","26","27","28","29",
+ // "21","22","23","24"
+ //});
+ //echartOption2.InitYdataText(new List<EnvironmentalSensorHistor>() {
+ // new EnvironmentalSensorHistor{ fieldName = "1", fieldValue= "23" },
+ // new EnvironmentalSensorHistor{ fieldName = "2", fieldValue= "22" },
+ // new EnvironmentalSensorHistor{ fieldName = "3", fieldValue= "11" },
+ // new EnvironmentalSensorHistor{ fieldName = "4", fieldValue= "21" },
+ // new EnvironmentalSensorHistor{ fieldName = "5", fieldValue= "41" },
+ // new EnvironmentalSensorHistor{ fieldName = "6", fieldValue= "23" },
+ // new EnvironmentalSensorHistor{ fieldName = "7", fieldValue= "31" },
+ // new EnvironmentalSensorHistor{ fieldName = "8", fieldValue= "23" },
+ // new EnvironmentalSensorHistor{ fieldName = "9", fieldValue= "11" },
+ // new EnvironmentalSensorHistor{ fieldName = "10", fieldValue= "21" },
+ // new EnvironmentalSensorHistor{ fieldName = "11", fieldValue= "24" },
+ // new EnvironmentalSensorHistor{ fieldName = "12", fieldValue= "41" },
+ // new EnvironmentalSensorHistor{ fieldName = "13", fieldValue= "32" },
+ // new EnvironmentalSensorHistor{ fieldName = "14", fieldValue= "23" },
+ // new EnvironmentalSensorHistor{ fieldName = "15", fieldValue= "23" },
+ // new EnvironmentalSensorHistor{ fieldName = "16", fieldValue= "22" },
+ // new EnvironmentalSensorHistor{ fieldName = "17", fieldValue= "11" },
+ // new EnvironmentalSensorHistor{ fieldName = "18", fieldValue= "21" },
+ // new EnvironmentalSensorHistor{ fieldName = "19", fieldValue= "41" },
+ // new EnvironmentalSensorHistor{ fieldName = "20", fieldValue= "23" },
+ // new EnvironmentalSensorHistor{ fieldName = "21", fieldValue= "31" },
+ // new EnvironmentalSensorHistor{ fieldName = "22", fieldValue= "23" },
+ // new EnvironmentalSensorHistor{ fieldName = "23", fieldValue= "11" },
+ // new EnvironmentalSensorHistor{ fieldName = "24", fieldValue= "21" },
+ //});
+ //infoView2_EchartsView.ShowWithOption(echartOption2.InitOption());
infoView2.AddChidren(new Button()
{
@@ -483,15 +479,18 @@
});
initQueryButton();
+
+ getPvElectricityHistory();
+ getLoadElectricityHistory();
}
/// <summary>
- /// 璇诲彇娓╁害鍊煎巻鍙叉暟鎹�
+ /// 璇诲彇鍙戠數閲忓巻鍙叉暟鎹�
/// hour=杩�24灏忔椂銆乨ay_hour =鏌愭棩24灏忔椂銆亀eek=杩戜竴鍛ㄣ�乵onth = 杩戜竴鏈堛�乧ustom_month=鏌愬勾鏌愭湀 y/M銆乧ustom_year=鏌愬勾 y
/// </summary>
- private void getTempHistory()
+ private void getPvElectricityHistory()
{
if (MainPage.NoLoginMode)
{
@@ -501,6 +500,7 @@
var loadPage = new Loading()
{
LodingBackgroundColor = 0x88888888,
+ BackgroundColor = 0x00FFFFFF,
};
infoView1.AddChidren(loadPage);
@@ -510,7 +510,7 @@
{
Application.RunOnMainThread(() =>
{
- loadPage.Start(Language.StringByID(StringId.PleaseWait));
+ loadPage.Start();
});
switch (queryType1)
@@ -563,9 +563,9 @@
}
/// <summary>
- /// 鑾峰彇鐢ㄦ按閲忓巻鍙茶褰�
+ /// 鑾峰彇鐢ㄧ數閲忓巻鍙茶褰�
/// </summary>
- private void getWaterHistory()
+ private void getLoadElectricityHistory()
{
if (MainPage.NoLoginMode)
{
@@ -574,6 +574,7 @@
var loadPage = new Loading()
{
LodingBackgroundColor = 0x88888888,
+ BackgroundColor = 0x00FFFFFF,
};
infoView2.AddChidren(loadPage);
@@ -583,7 +584,7 @@
{
Application.RunOnMainThread(() =>
{
- loadPage.Start(Language.StringByID(StringId.PleaseWait));
+ loadPage.Start();
});
switch (queryType2)
{
@@ -614,6 +615,7 @@
Application.RunOnMainThread(() =>
{
+ var ddd = echartOption2.InitOption();
infoView2_EchartsView.ShowWithOption(echartOption2.InitOption());
});
}
@@ -641,110 +643,81 @@
{
SetTempQureyDateDialog();
};
- infoView1_DateInfo_PreClickButton.MouseUpEventHandler = (sender, e) => {
- var tempQueryDate = new DateTime(queryTime_Year1, queryTime_Month1, queryTime_Day1);
+ infoView1_DateInfo_PreClickButton.MouseUpEventHandler = (sender, e) =>
+ {
+ var pvElecQueryDate = 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)
+ if (pvElecQueryDate.Year <= 2023 && pvElecQueryDate.Month == 1 && pvElecQueryDate.Day == 1)
{
- infoView1_DateInfo_PreIconButton.Visible = false;
- infoView1_DateInfo_PreClickButton.Enable = false;
+ return;
}
- 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;
- }
+ pvElecQueryDate = pvElecQueryDate.AddDays(-1);
+ infoView1_DateInfo_DateTextButton.Text = pvElecQueryDate.ToString("yyyy-MM-dd");
}
else if (queryType1 == QueryType.custom_month)
{
- tempQueryDate = tempQueryDate.AddMonths(-1);
- if (tempQueryDate.Year == 2023 && tempQueryDate.Month == 1)
+ if (pvElecQueryDate.Year <= 2023 && pvElecQueryDate.Month == 1)
{
- infoView1_DateInfo_PreIconButton.Visible = false;
- infoView1_DateInfo_PreClickButton.Enable = false;
+ return;
}
- if (tempQueryDate.Year == DateTime.Now.Year && tempQueryDate.Month == DateTime.Now.Month - 1)
- {
- infoView1_DateInfo_NextIconButton.Visible = true;
- infoView1_DateInfo_NextClickButton.Enable = true;
- }
+ pvElecQueryDate = pvElecQueryDate.AddMonths(-1);
+ queryTime_Day1 = pvElecQueryDate.Day;
+ infoView1_DateInfo_DateTextButton.Text = pvElecQueryDate.ToString("yyyy-MM");
}
else if (queryType1 == QueryType.custom_year)
{
- tempQueryDate = tempQueryDate.AddYears(-1);
- if (tempQueryDate.Year == 2023)
+ if (pvElecQueryDate.Year <= 2023)
{
- infoView1_DateInfo_PreIconButton.Visible = false;
- infoView1_DateInfo_PreClickButton.Enable = false;
+ return;
}
- if (tempQueryDate.Year == DateTime.Now.Year - 1)
- {
- infoView1_DateInfo_NextIconButton.Visible = true;
- infoView1_DateInfo_NextClickButton.Enable = true;
- }
+ pvElecQueryDate = pvElecQueryDate.AddYears(-1);
+ infoView1_DateInfo_DateTextButton.Text = pvElecQueryDate.ToString("yyyy");
}
- queryTime_Year1 = tempQueryDate.Year;
- queryTime_Month1 = tempQueryDate.Month;
- queryTime_Day1 = tempQueryDate.Day;
- infoView1_DateInfo_DateTextButton.Text = tempQueryDate.ToString("yyyy-MM-dd");
- getTempHistory();
+ queryTime_Year1 = pvElecQueryDate.Year;
+ queryTime_Month1 = pvElecQueryDate.Month;
+ queryTime_Day1 = pvElecQueryDate.Day;
+ getPvElectricityHistory();
};
- 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);
+ infoView1_DateInfo_NextClickButton.MouseUpEventHandler = (sender, e) =>
+ {
+ var pvElecQueryDate = 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)
+ if (pvElecQueryDate.Year == DateTime.Now.Year && pvElecQueryDate.Month == DateTime.Now.Month && pvElecQueryDate.Day == DateTime.Now.Day)
{
- infoView1_DateInfo_PreIconButton.Visible = true;
- infoView1_DateInfo_PreClickButton.Enable = true;
+ return;
}
- 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;
- }
+ pvElecQueryDate = pvElecQueryDate.AddDays(1);
+ infoView1_DateInfo_DateTextButton.Text = pvElecQueryDate.ToString("yyyy-MM-dd");
}
else if (queryType1 == QueryType.custom_month)
{
- tempQueryDate = tempQueryDate.AddMonths(1);
- if (tempQueryDate.Year == 2023 && tempQueryDate.Month == 2)
+ if (pvElecQueryDate.Year == DateTime.Now.Year && pvElecQueryDate.Month == DateTime.Now.Month)
{
- infoView1_DateInfo_PreIconButton.Visible = true;
- infoView1_DateInfo_PreClickButton.Enable = true;
+ return;
}
- if (tempQueryDate.Year == DateTime.Now.Year && tempQueryDate.Month == DateTime.Now.Month)
- {
- infoView1_DateInfo_NextIconButton.Visible = false;
- infoView1_DateInfo_NextClickButton.Enable = false;
- }
+ pvElecQueryDate = pvElecQueryDate.AddMonths(1);
+ queryTime_Day1 = pvElecQueryDate.Day;
+ infoView1_DateInfo_DateTextButton.Text = pvElecQueryDate.ToString("yyyy-MM");
}
else if (queryType1 == QueryType.custom_year)
{
- tempQueryDate = tempQueryDate.AddYears(1);
- if (tempQueryDate.Year == 2023)
+ if (pvElecQueryDate.Year >= DateTime.Now.Year)
{
- infoView1_DateInfo_PreIconButton.Visible = false;
- infoView1_DateInfo_PreClickButton.Enable = false;
+ return;
}
- if (tempQueryDate.Year == DateTime.Now.Year)
- {
- infoView1_DateInfo_NextIconButton.Visible = false;
- infoView1_DateInfo_NextClickButton.Enable = false;
- }
+ pvElecQueryDate = pvElecQueryDate.AddYears(1);
+ infoView1_DateInfo_DateTextButton.Text = pvElecQueryDate.ToString("yyyy");
}
- queryTime_Year1 = tempQueryDate.Year;
- queryTime_Month1 = tempQueryDate.Month;
- queryTime_Day1 = tempQueryDate.Day;
- infoView1_DateInfo_DateTextButton.Text = tempQueryDate.ToString("yyyy-MM-dd");
- getTempHistory();
+ queryTime_Year1 = pvElecQueryDate.Year;
+ queryTime_Month1 = pvElecQueryDate.Month;
+ queryTime_Day1 = pvElecQueryDate.Day;
+ getPvElectricityHistory();
};
- infoView1_Date_Day.MouseUpEventHandler = (sender, e) => {
+ infoView1_Date_Day.MouseUpEventHandler = (sender, e) =>
+ {
if (infoView1_Date_Day.IsSelected)
{
return;
@@ -753,10 +726,17 @@
infoView1_Date_Month.IsSelected = false;
infoView1_Date_Year.IsSelected = false;
queryType1 = QueryType.day_hour;
+ if (DateTime.Now.Date < new DateTime(queryTime_Year1, queryTime_Month1, queryTime_Day1))
+ {
+ queryTime_Year1 = DateTime.Now.Year;
+ queryTime_Month1 = DateTime.Now.Month;
+ queryTime_Day1 = DateTime.Now.Day;
+ }
infoView1_DateInfo_DateTextButton.Text = new DateTime(queryTime_Year1, queryTime_Month1, queryTime_Day1).ToString("yyyy-MM-dd");
- getTempHistory();
+ getPvElectricityHistory();
};
- infoView1_Date_Month.MouseUpEventHandler = (sender, e) => {
+ infoView1_Date_Month.MouseUpEventHandler = (sender, e) =>
+ {
if (infoView1_Date_Month.IsSelected)
{
return;
@@ -765,10 +745,16 @@
infoView1_Date_Month.IsSelected = true;
infoView1_Date_Year.IsSelected = false;
queryType1 = QueryType.custom_month;
+ if (DateTime.Now.Date < new DateTime(queryTime_Year1, queryTime_Month1, queryTime_Day1))
+ {
+ queryTime_Year1 = DateTime.Now.Year;
+ queryTime_Month1 = DateTime.Now.Month;
+ }
infoView1_DateInfo_DateTextButton.Text = new DateTime(queryTime_Year1, queryTime_Month1, queryTime_Day1).ToString("yyyy-MM");
- getTempHistory();
+ getPvElectricityHistory();
};
- infoView1_Date_Year.MouseUpEventHandler = (sender, e) => {
+ infoView1_Date_Year.MouseUpEventHandler = (sender, e) =>
+ {
if (infoView1_Date_Year.IsSelected)
{
return;
@@ -778,116 +764,87 @@
infoView1_Date_Year.IsSelected = true;
queryType1 = QueryType.custom_year;
infoView1_DateInfo_DateTextButton.Text = queryTime_Year1.ToString();
- getTempHistory();
+ getPvElectricityHistory();
};
//-----------鐢ㄦ按
infoView2_DateInfo_DateTextButton.MouseUpEventHandler = (sender, e) =>
{
SetWaterQureyDateDialog();
};
- infoView2_DateInfo_PreClickButton.MouseUpEventHandler = (sender, e) => {
+ infoView2_DateInfo_PreClickButton.MouseUpEventHandler = (sender, e) =>
+ {
var waterQueryDate = new DateTime(queryTime_Year2, queryTime_Month2, queryTime_Day2);
if (queryType2 == QueryType.day_hour)
{
+ if (waterQueryDate.Year <= 2023 && waterQueryDate.Month == 1 && waterQueryDate.Day == 1)
+ {
+ return;
+ }
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;
- }
+ infoView2_DateInfo_DateTextButton.Text = waterQueryDate.ToString("yyyy-MM-dd");
}
else if (queryType2 == QueryType.custom_month)
{
+ if (waterQueryDate.Year <= 2023 && waterQueryDate.Month == 1)
+ {
+ return;
+ }
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;
- }
+ queryTime_Day2 = waterQueryDate.Day;
+ infoView2_DateInfo_DateTextButton.Text = waterQueryDate.ToString("yyyy-MM");
}
else if (queryType2 == QueryType.custom_year)
{
+ if (waterQueryDate.Year <= 2023)
+ {
+ return;
+ }
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;
- }
+ infoView2_DateInfo_DateTextButton.Text = waterQueryDate.ToString("yyyy");
}
queryTime_Year2 = waterQueryDate.Year;
queryTime_Month2 = waterQueryDate.Month;
queryTime_Day2 = waterQueryDate.Day;
- infoView2_DateInfo_DateTextButton.Text = waterQueryDate.ToString("yyyy-MM-dd");
- getWaterHistory();
+ getLoadElectricityHistory();
};
- infoView2_DateInfo_NextIconButton.Visible = false;
- infoView2_DateInfo_NextClickButton.Enable = false;
- infoView2_DateInfo_NextClickButton.MouseUpEventHandler = (sender, e) => {
+ 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;
+ return;
}
+ waterQueryDate = waterQueryDate.AddDays(1);
+ infoView2_DateInfo_DateTextButton.Text = waterQueryDate.ToString("yyyy-MM-dd");
}
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;
+ return;
}
+ waterQueryDate = waterQueryDate.AddMonths(1);
+ queryTime_Day2 = waterQueryDate.Day;
+ infoView2_DateInfo_DateTextButton.Text = waterQueryDate.ToString("yyyy-MM");
}
else if (queryType2 == QueryType.custom_year)
{
+ if (waterQueryDate.Year >= DateTime.Now.Year)
+ {
+ return;
+ }
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;
- }
+ infoView2_DateInfo_DateTextButton.Text = waterQueryDate.ToString("yyyy");
}
queryTime_Year2 = waterQueryDate.Year;
queryTime_Month2 = waterQueryDate.Month;
queryTime_Day2 = waterQueryDate.Day;
- infoView2_DateInfo_DateTextButton.Text = waterQueryDate.ToString("yyyy-MM-dd");
- getWaterHistory();
+ getLoadElectricityHistory();
};
- infoView2_Date_Day.MouseDownEventHandler = (sender, e) => {
+ infoView2_Date_Day.MouseDownEventHandler = (sender, e) =>
+ {
if (infoView2_Date_Day.IsSelected)
{
return;
@@ -896,10 +853,17 @@
infoView2_Date_Month.IsSelected = false;
infoView2_Date_Year.IsSelected = false;
queryType2 = QueryType.day_hour;
+ if (DateTime.Now.Date < new DateTime(queryTime_Year2, queryTime_Month2, queryTime_Day2))
+ {
+ queryTime_Year2 = DateTime.Now.Year;
+ queryTime_Month2 = DateTime.Now.Month;
+ queryTime_Day2 = DateTime.Now.Day;
+ }
infoView2_DateInfo_DateTextButton.Text = new DateTime(queryTime_Year2, queryTime_Month2, queryTime_Day2).ToString("yyyy-MM-dd");
- getWaterHistory();
+ getLoadElectricityHistory();
};
- infoView2_Date_Month.MouseDownEventHandler = (sender, e) => {
+ infoView2_Date_Month.MouseDownEventHandler = (sender, e) =>
+ {
if (infoView2_Date_Month.IsSelected)
{
return;
@@ -908,10 +872,16 @@
infoView2_Date_Month.IsSelected = true;
infoView2_Date_Year.IsSelected = false;
queryType2 = QueryType.custom_month;
+ if (DateTime.Now.Date < new DateTime(queryTime_Year2, queryTime_Month2, queryTime_Day2))
+ {
+ queryTime_Year2 = DateTime.Now.Year;
+ queryTime_Month2 = DateTime.Now.Month;
+ }
infoView2_DateInfo_DateTextButton.Text = new DateTime(queryTime_Year2, queryTime_Month2, queryTime_Day2).ToString("yyyy-MM");
- getWaterHistory();
+ getLoadElectricityHistory();
};
- infoView2_Date_Year.MouseDownEventHandler = (sender, e) => {
+ infoView2_Date_Year.MouseDownEventHandler = (sender, e) =>
+ {
if (infoView2_Date_Year.IsSelected)
{
return;
@@ -921,7 +891,7 @@
infoView2_Date_Year.IsSelected = true;
queryType2 = QueryType.custom_year;
infoView2_DateInfo_DateTextButton.Text = queryTime_Year2.ToString();
- getWaterHistory();
+ getLoadElectricityHistory();
};
}
@@ -1039,6 +1009,19 @@
};
topView.AddChidren(btnConfrim);
+ var btnToday = new Button()
+ {
+ X = Application.GetRealWidth(160 - 32) - btnConfrim.GetTextWidth(),
+ Width = Application.GetRealWidth(160),
+ TextAlignment = TextAlignment.CenterRight,
+ TextColor = CSS_Color.MainColor,
+ TextSize = CSS_FontSize.TextFontSize,
+ Visible = false,
+ Enable = false,
+ Text = "浠婃棩",
+ };
+ topView.AddChidren(btnToday);
+
UIPickerView uIPickerView = new UIPickerView()
{
Y = Application.GetRealHeight(40),
@@ -1064,97 +1047,118 @@
};
uIPickerView.OnSelectChangeEvent = (int1, int2, int3) =>
{
- if (pickerItems_Year[int1] != item1.ToString())
+ try
{
- int.TryParse(pickerItems_Year[int1], out item1);
- if (queryType1 == QueryType.custom_month || queryType1 == QueryType.day_hour)
+ if (int1 < 0)
{
- 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());
- }
- }
- }
+ int1 = 1;
}
- 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())
+ if (pickerItems_Year[int1] != item1.ToString())
{
- int.TryParse(pickerItems_Month[int2], out item2);
- if (queryType1 == QueryType.day_hour)
+ int.TryParse(pickerItems_Year[int1], out item1);
+ if (queryType1 == QueryType.custom_month || queryType1 == QueryType.day_hour)
{
- pickerItems_Day = new List<string>();
- if (item1 == DateTime.Now.Year && item2 == DateTime.Now.Month)
+ pickerItems_Month = new List<string>();
+ if (item1 == DateTime.Now.Year)
{
- int addDay = 0;
- while (DateTime.Now.Day > addDay)
+ int addMonth = 0;
+ while (DateTime.Now.Month > addMonth)
{
- addDay++;
- pickerItems_Day.Add(addDay.ToString());
+ addMonth++;
+ pickerItems_Month.Add(addMonth.ToString());
}
}
else
{
- for (var i = 1; i <= DateTime.DaysInMonth(item1, item2); i++)
+ for (var i = 1; i < 13; i++)
{
- pickerItems_Day.Add(i.ToString());
+ 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 (int2 >= pickerItems_Month.Count || int2 < 0)
+ {
+ int2 = 0;
+ }
+ 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());
+ }
+ }
+ }
+ try
+ {
+ 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()));
+ }
+ catch (Exception ex)
+ {
+ MainPage.Log("Error", $"閲戣寕鍘嗗彶鏁版嵁鎺т欢寮傚父:{ex.Message}");
+ }
+ }
+ }
+ if (pickerItems_Day != null)
+ {
+ if (int3 >= pickerItems_Day.Count || int3 < 0)
+ {
+ int3 = 0;
+ }
+ if (pickerItems_Day[int3] != item3.ToString())
+ {
+ int.TryParse(pickerItems_Day[int3], out item3);
+ }
}
}
- if (pickerItems_Day != null)
+ catch (Exception ex)
{
- if (int3 >= pickerItems_Day.Count)
- {
- int3 = 0;
- }
- if (pickerItems_Day[int3] != item3.ToString())
- {
- int.TryParse(pickerItems_Day[int3], out item3);
- }
+ MainPage.Log("Error", $"閲戣寕鐑按鍣ㄦ棩鏈熼�夋嫨寮傚父锛歿ex.StackTrace}");
}
};
btnConfrim.MouseUpEventHandler = (sender, e) =>
@@ -1168,7 +1172,7 @@
{
queryTime_Month1 = item2;
}
- infoView1_DateInfo_DateTextButton.Text = new DateTime(queryTime_Year1, queryTime_Month1, queryTime_Day1).ToString("yyyy-MM");
+ infoView1_DateInfo_DateTextButton.Text = new DateTime(queryTime_Year1, queryTime_Month1, 1).ToString("yyyy-MM");
if (queryType1 == QueryType.day_hour)
{
if (item3 != queryTime_Day1)
@@ -1178,9 +1182,50 @@
infoView1_DateInfo_DateTextButton.Text = new DateTime(queryTime_Year1, queryTime_Month1, queryTime_Day1).ToString("yyyy-MM-dd");
}
}
- getTempHistory();
+ getPvElectricityHistory();
};
+
+ if (queryType1 == QueryType.day_hour)
+ {
+ try
+ {
+ btnToday.Visible = btnToday.Enable = true;
+ btnToday.MouseUpEventHandler = (sender, e) =>
+ {
+ item3 = queryTime_Day1 = DateTime.Now.Day;
+ item2 = queryTime_Month1 = DateTime.Now.Month;
+ item1 = queryTime_Year1 = DateTime.Now.Year;
+ pickerItems_Year = new List<string>();
+ pickerItems_Year.Add("2023");
+ while (DateTime.Now.Year > 2022 + pickerItems_Year.Count)
+ {
+ pickerItems_Year.Add((2023 + pickerItems_Year.Count).ToString());
+ }
+
+ pickerItems_Month = new List<string>();
+ int addMonth = 0;
+ while (DateTime.Now.Month > addMonth)
+ {
+ addMonth++;
+ pickerItems_Month.Add(addMonth.ToString());
+ }
+ pickerItems_Day = new List<string>();
+ int addDay = 0;
+ while(DateTime.Now.Day > addDay)
+ {
+ addDay++;
+ pickerItems_Day.Add(addDay.ToString());
+ }
+
+ 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()));
+ };
+ }
+ catch { }
+ }
}
public void SetWaterQureyDateDialog()
@@ -1319,97 +1364,112 @@
};
uIPickerView.OnSelectChangeEvent = (int1, int2, int3) =>
{
- if (pickerItems_Year[int1] != item1.ToString())
+ try
{
- int.TryParse(pickerItems_Year[int1], out item1);
- if (queryType2 == QueryType.custom_month || queryType2 == QueryType.day_hour)
+ if (int1 < 0)
{
- 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());
- }
- }
- }
+ int1 = 0;
}
- 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())
+ if (pickerItems_Year[int1] != item1.ToString())
{
- int.TryParse(pickerItems_Month[int2], out item2);
- if (queryType2 == QueryType.day_hour)
+ int.TryParse(pickerItems_Year[int1], out item1);
+ if (queryType2 == QueryType.custom_month || queryType2 == QueryType.day_hour)
{
- pickerItems_Day = new List<string>();
- if (item1 == DateTime.Now.Year && item2 == DateTime.Now.Month)
+ pickerItems_Month = new List<string>();
+ if (item1 == DateTime.Now.Year)
{
- int addDay = 0;
- while (DateTime.Now.Day > addDay)
+ int addMonth = 0;
+ while (DateTime.Now.Month > addMonth)
{
- addDay++;
- pickerItems_Day.Add(addDay.ToString());
+ addMonth++;
+ pickerItems_Month.Add(addMonth.ToString());
}
}
else
{
- for (var i = 1; i <= DateTime.DaysInMonth(item1, item2); i++)
+ for (var i = 1; i < 13; i++)
{
- pickerItems_Day.Add(i.ToString());
+ 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 (int2 > pickerItems_Month.Count || int2 < 0)
+ {
+ int2 = 0;
+ }
+ 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)
+ {
+ int3 = 0;
+ }
+ if (pickerItems_Day[int3] != item3.ToString())
+ {
+ int.TryParse(pickerItems_Day[int3], out item3);
+ }
}
}
- if (pickerItems_Day != null)
+ catch (Exception ex)
{
- if (int3 >= pickerItems_Day.Count)
- {
- int3 = 0;
- }
- if (pickerItems_Day[int3] != item3.ToString())
- {
- int.TryParse(pickerItems_Day[int3], out item3);
- }
+ MainPage.Log("Error", $"閲戣寕鍏変紡鏃ユ湡2閫夋嫨寮傚父锛歿ex.StackTrace}");
}
};
btnConfrim.MouseUpEventHandler = (sender, e) =>
@@ -1423,7 +1483,7 @@
{
queryTime_Month2 = item2;
}
- infoView2_DateInfo_DateTextButton.Text = new DateTime(queryTime_Year2, queryTime_Month2, queryTime_Day2).ToString("yyyy-MM");
+ infoView2_DateInfo_DateTextButton.Text = new DateTime(queryTime_Year2, queryTime_Month2, 1).ToString("yyyy-MM");
if (queryType2 == QueryType.day_hour)
{
if (item3 != queryTime_Day2)
@@ -1433,13 +1493,69 @@
infoView2_DateInfo_DateTextButton.Text = new DateTime(queryTime_Year2, queryTime_Month2, queryTime_Day2).ToString("yyyy-MM-dd");
}
}
- getWaterHistory();
+ getLoadElectricityHistory();
};
+
+ var btnToday = new Button()
+ {
+ X = Application.GetRealWidth(160 - 32) - btnConfrim.GetTextWidth(),
+ Width = Application.GetRealWidth(160),
+ TextAlignment = TextAlignment.CenterRight,
+ TextColor = CSS_Color.MainColor,
+ TextSize = CSS_FontSize.TextFontSize,
+ Visible = false,
+ Enable = false,
+ Text = "浠婃棩",
+ };
+ topView.AddChidren(btnToday);
+
+
+ if (queryType2 == QueryType.day_hour)
+ {
+ try
+ {
+ btnToday.Visible = btnToday.Enable = true;
+ btnToday.MouseUpEventHandler = (sender, e) =>
+ {
+ item3 = queryTime_Day2 = DateTime.Now.Day;
+ item2 = queryTime_Month2 = DateTime.Now.Month;
+ item1 = queryTime_Year2 = DateTime.Now.Year;
+
+ pickerItems_Year = new List<string>();
+ pickerItems_Year.Add("2023");
+ while (DateTime.Now.Year > 2022 + pickerItems_Year.Count)
+ {
+ pickerItems_Year.Add((2023 + pickerItems_Year.Count).ToString());
+ }
+
+ pickerItems_Month = new List<string>();
+ int addMonth = 0;
+ while (DateTime.Now.Month > addMonth)
+ {
+ addMonth++;
+ pickerItems_Month.Add(addMonth.ToString());
+ }
+ pickerItems_Day = new List<string>();
+ int addDay = 0;
+ while (DateTime.Now.Day > addDay)
+ {
+ addDay++;
+ pickerItems_Day.Add(addDay.ToString());
+ }
+
+ 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()));
+ };
+ }
+ catch { }
+ }
}
- }
-}
+ }
+}
\ No newline at end of file
--
Gitblit v1.8.0