|
@@ -16,6 +16,8 @@ using System.Windows.Media.Animation;
|
|
|
using System.Windows.Media.Imaging;
|
|
|
using System.Windows.Navigation;
|
|
|
using System.Windows.Shapes;
|
|
|
+using System.Linq;
|
|
|
+using System.Globalization;
|
|
|
|
|
|
namespace Bellwether.Pages
|
|
|
{
|
|
@@ -88,15 +90,39 @@ namespace Bellwether.Pages
|
|
|
{
|
|
|
var solarInfo = GetSolarInfo();
|
|
|
|
|
|
- uxCapacity.Text = solarInfo.Capacity.ToString();
|
|
|
+ if (solarInfo is null)
|
|
|
+ {
|
|
|
+ DisplayEmptySolarInfo();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ DisplaySolarInfo(solarInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void DisplayEmptySolarInfo()
|
|
|
+ {
|
|
|
+ const string emptyNumber = "---";
|
|
|
+ uxCapacity.Text = emptyNumber;
|
|
|
+
|
|
|
+ uxEnergy_Today.Text = emptyNumber;
|
|
|
+ uxCO2EmissionSaved_Today.Text = emptyNumber;
|
|
|
+ uxEquivalentTreesPlanted_Today.Text = emptyNumber;
|
|
|
+
|
|
|
+ uxEnergy_ThisYear.Text = emptyNumber;
|
|
|
+ uxCO2EmissionSaved_ThisYear.Text = emptyNumber;
|
|
|
+ uxEquivalentTreesPlanted_ThisYear.Text = emptyNumber;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void DisplaySolarInfo(SolarInfoModel solarInfo)
|
|
|
+ {
|
|
|
+ uxCapacity.Text = solarInfo.Capacity.ToString("#,##0");
|
|
|
|
|
|
- uxEnergy_Today.Text = solarInfo.Energy_Today.ToString();
|
|
|
- uxCO2EmissionSaved_Today.Text = solarInfo.CO2EmissionSaved_Today.ToString("0.000");
|
|
|
- uxEquivalentTreesPlanted_Today.Text = solarInfo.EquivalentTreesPlanted_Today.ToString("0.000");
|
|
|
+ uxEnergy_Today.Text = solarInfo.Energy_Today.ToString("#,##0");
|
|
|
+ uxCO2EmissionSaved_Today.Text = solarInfo.CO2EmissionSaved_Today.ToString("#,##0");
|
|
|
+ uxEquivalentTreesPlanted_Today.Text = solarInfo.EquivalentTreesPlanted_Today.ToString("#,##0");
|
|
|
|
|
|
- uxEnergy_ThisYear.Text = solarInfo.Energy_ThisYear.ToString();
|
|
|
- uxCO2EmissionSaved_ThisYear.Text = solarInfo.CO2EmissionSaved_ThisYear.ToString("0.000");
|
|
|
- uxEquivalentTreesPlanted_ThisYear.Text = solarInfo.EquivalentTreesPlanted_ThisYear.ToString("0.000");
|
|
|
+ uxEnergy_ThisYear.Text = solarInfo.Energy_ThisYear.ToString("#,##0");
|
|
|
+ uxCO2EmissionSaved_ThisYear.Text = solarInfo.CO2EmissionSaved_ThisYear.ToString("#,##0");
|
|
|
+ uxEquivalentTreesPlanted_ThisYear.Text = solarInfo.EquivalentTreesPlanted_ThisYear.ToString("#,##0");
|
|
|
}
|
|
|
|
|
|
private void UpdateDateTimeInfo()
|