瀏覽代碼

fit customer layout
change solar energy info numeric data type into string

Robert 1 年之前
父節點
當前提交
c53f680c53

+ 15 - 0
Bellwether/App.config

@@ -19,6 +19,21 @@
             <setting name="Screensaver" serializeAs="String">
                 <value>D:\RobertProject\Bellwether\Project\Bellwether\bin\Debug\Ribbons.scr</value>
             </setting>
+            <setting name="SolarPanelBg" serializeAs="String">
+                <value>bg.png</value>
+            </setting>
+            <setting name="SolarEnergyUrl" serializeAs="String">
+                <value>http://plm.bellwether-corp.com:8081/BW_Service.asmx/ExportSolarenergy_All_1</value>
+            </setting>
+            <setting name="SolarCapacityUrl" serializeAs="String">
+                <value>http://plm.bellwether-corp.com:8081/BW_Service.asmx/ExportSolarenergy_All_2</value>
+            </setting>
+            <setting name="TitleTextUrl1" serializeAs="String">
+                <value>http://plm.bellwether-corp.com:8081/BW_Service.asmx/ExportSolarenergy_All_3</value>
+            </setting>
+            <setting name="TitleTextUrl2" serializeAs="String">
+                <value>http://plm.bellwether-corp.com:8081/BW_Service.asmx/ExportSolarenergy_All_4</value>
+            </setting>
         </Bellwether.Properties.Settings>
     </userSettings>
 </configuration>

+ 3 - 0
Bellwether/Bellwether.csproj

@@ -209,6 +209,9 @@
     <Content Include="DLL\Newtonsoft.Json.dll" />
     <Content Include="DLL\NLPlaneRotator.dll" />
     <Content Include="DLL\SocketTransfer.dll" />
+    <Resource Include="Images\Final Solar_Show3.png" />
+    <Resource Include="Images\bg.png" />
+    <Resource Include="Images\Final Solar_Show2.png" />
     <Resource Include="Images\test2.png" />
     <Resource Include="Images\Historywall\menu_bg_clean.png" />
     <Resource Include="Images\Historywall\button_left.png" />

+ 28 - 10
Bellwether/BellwetherAPI/BellwetherAPI.cs

@@ -1,5 +1,6 @@
 using Bellwether.Model;
 using Newtonsoft.Json;
+using RestSharp;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -10,11 +11,15 @@ using System.Threading.Tasks;
 
 namespace Bellwether
 {
-    public class BellwetherAPI
+    public static class BellwetherAPI
     {
-        public async Task<List<SolarEnergyModel>> GetSolarenergy()
+        public static async Task<List<SolarEnergyModel>> GetSolarenergy()
         {
             var url = "http://plm.bellwether-corp.com:8081/BW_Service.asmx/ExportSolarenergy_All_1";
+            if (!string.IsNullOrEmpty(Properties.Settings.Default.SolarEnergyUrl))
+            {
+                url = Properties.Settings.Default.SolarEnergyUrl;
+            }
             var result = await CallApi<SolarEnergyRawModel>(url);
             if (result == null)
             {
@@ -24,16 +29,20 @@ namespace Bellwether
             foreach(var rawData in result)
             {
                 var parseResult = SolarEnergyModel.Parse(rawData);
-                if (string.IsNullOrEmpty(parseResult.Area))
+                if (string.IsNullOrEmpty(parseResult.Unit))
                     continue;
                 toReturn.Add(parseResult);
             }
             return toReturn;
         }
 
-        public async Task<List<SolarenergyCapacityModel>> GetSolarenergyCapacity()
+        public static async Task<List<SolarenergyCapacityModel>> GetSolarenergyCapacity()
         {
             var url = "http://plm.bellwether-corp.com:8081/BW_Service.asmx/ExportSolarenergy_All_2";
+            if (!string.IsNullOrEmpty(Properties.Settings.Default.SolarCapacityUrl))
+            {
+                url = Properties.Settings.Default.SolarCapacityUrl;
+            }
             var result = await CallApi<SolarenergyCapacityRawModel>(url);
             if (result == null)
             {
@@ -43,16 +52,18 @@ namespace Bellwether
             foreach (var rawData in result)
             {
                 var parseResult = SolarenergyCapacityModel.Parse(rawData);
-                if (string.IsNullOrEmpty(parseResult.Area))
-                    continue;
                 toReturn.Add(parseResult);
             }
             return toReturn;
         }
 
-        public async Task<TitleModel> GetSolarenergyTitle1()
+        public static async Task<TitleModel> GetSolarenergyTitle1()
         {
             var url = "http://plm.bellwether-corp.com:8081/BW_Service.asmx/ExportSolarenergy_All_3";
+            if (!string.IsNullOrEmpty(Properties.Settings.Default.TitleTextUrl1))
+            {
+                url = Properties.Settings.Default.TitleTextUrl1;
+            }
             var result = await CallApi<TitleRawModel>(url);
             if (result == null || result.Count() == 0)
             {
@@ -61,9 +72,13 @@ namespace Bellwether
             return TitleModel.Parse(result[0]);
         }
 
-        public async Task<TitleModel> GetSolarenergyTitle2()
+        public static async Task<TitleModel> GetSolarenergyTitle2()
         {
             var url = "http://plm.bellwether-corp.com:8081/BW_Service.asmx/ExportSolarenergy_All_4";
+            if (!string.IsNullOrEmpty(Properties.Settings.Default.TitleTextUrl2))
+            {
+                url = Properties.Settings.Default.TitleTextUrl2;
+            }
             var result = await CallApi<TitleRawModel>(url);
             if (result == null || result.Count() == 0)
             {
@@ -72,9 +87,12 @@ namespace Bellwether
             return TitleModel.Parse(result[0]);
         }
 
-        private async Task<T[]> CallApi<T>(string url)
+        private static async Task<T[]> CallApi<T>(string url)
         {
-            var result = await new HttpClient().GetStringAsync(url);
+            var client = new RestClient(url);
+            var requet = new RestRequest() { Method = Method.GET };
+            var restResult = await client.ExecuteAsync(requet);
+            var result = restResult.Content;
             Regex regex = new Regex(".*\"data\":(\\[.*\\]).*");
             var matchResult = regex.Match(result);
             if (matchResult == null || !matchResult.Success || matchResult.Groups.Count <= 1)

+ 9 - 12
Bellwether/BellwetherAPI/Model/SolarEnergyModel.cs

@@ -9,9 +9,10 @@ namespace Bellwether.Model
     public class SolarEnergyModel
     {
         public string Area { get; set; }
-        public long Energy { get; set; }
-        public long CO2EmissionSaved { get; set; }
-        public long EquivalentTreesPlanted { get; set; }
+        public string Unit { get; set; }
+        public string Energy { get; set; }
+        public string CO2EmissionSaved { get; set; }
+        public string EquivalentTreesPlanted { get; set; }
 
         public static SolarEnergyModel Parse(SolarEnergyRawModel rawModel)
         {
@@ -19,18 +20,13 @@ namespace Bellwether.Model
             {
                 return new SolarEnergyModel();
             }
-            if (!long.TryParse(rawModel.Energy, out var energy) ||
-                !long.TryParse(rawModel.CO2EmissionSaved, out var co2EmissionSaved) ||
-                !long.TryParse(rawModel.EquivalentTreesPlanted, out var equivalentTreesPlanted))
-            {
-                return new SolarEnergyModel();
-            }
             return new SolarEnergyModel()
             {
                 Area = rawModel.Area,
-                Energy = energy,
-                CO2EmissionSaved = co2EmissionSaved,
-                EquivalentTreesPlanted = equivalentTreesPlanted
+                Unit = rawModel.Unit,
+                Energy = rawModel.Energy,
+                CO2EmissionSaved = rawModel.CO2EmissionSaved,
+                EquivalentTreesPlanted = rawModel.EquivalentTreesPlanted
             };
         }
     }
@@ -38,6 +34,7 @@ namespace Bellwether.Model
     public class SolarEnergyRawModel
     {
         public string Area { get; set; }
+        public string Unit { get; set; }
         public string Energy { get; set; }
         public string CO2EmissionSaved { get; set; }
         public string EquivalentTreesPlanted { get; set; }

+ 3 - 8
Bellwether/BellwetherAPI/Model/SolarenergyCapacityModel.cs

@@ -9,7 +9,7 @@ namespace Bellwether.Model
     public class SolarenergyCapacityModel
     {
         public string Area { get; set; }
-        public long Capacity { get; set; }
+        public string Capacity { get; set; }
 
         public static SolarenergyCapacityModel Parse(SolarenergyCapacityRawModel rawModel)
         {
@@ -18,15 +18,10 @@ namespace Bellwether.Model
                 return new SolarenergyCapacityModel();
             }
 
-            if (!long.TryParse(rawModel.Capacity, out var capacity))
-            {
-                return new SolarenergyCapacityModel();
-            }
-
             return new SolarenergyCapacityModel()
             {
-                Area = rawModel.Area,
-                Capacity = capacity
+                Area = rawModel.Area ?? "",
+                Capacity = rawModel.Capacity ?? "",
             };
         }
     }

+ 2 - 7
Bellwether/BellwetherAPI/Model/TitleModel.cs

@@ -9,7 +9,7 @@ namespace Bellwether.Model
     public class TitleModel
     {
         public string Title { get; set; }
-        public long Content { get; set; }
+        public string Content { get; set; }
 
         public static TitleModel Parse(TitleRawModel rawModel)
         {
@@ -18,15 +18,10 @@ namespace Bellwether.Model
                 return new TitleModel();
             }
 
-            if (!long.TryParse(rawModel.Content, out var content))
-            {
-                return new TitleModel();
-            }
-
             return new TitleModel()
             {
                 Title = rawModel.Title,
-                Content = content
+                Content = rawModel.Content
             };
         }
     }

二進制
Bellwether/Images/Final Solar_Show2.png


二進制
Bellwether/Images/Final Solar_Show3.png


二進制
Bellwether/Images/bg.png


+ 354 - 372
Bellwether/Pages/ucFrontPage.xaml

@@ -16,38 +16,6 @@
     <UserControl.Resources />
     <UserControl.Triggers>
         <EventTrigger RoutedEvent="Loaded">
-            <BeginStoryboard>
-                <Storyboard RepeatBehavior="Forever" Duration="0:0:7">
-                    <PointAnimation
-                        Storyboard.TargetName="uxSolarEnergyLightBrush"
-                        Storyboard.TargetProperty="StartPoint"
-                        From="-100,-100"
-                        To="1788,460"
-                        Duration="0:0:1" />
-                    <PointAnimation
-                        Storyboard.TargetName="uxSolarEnergyLightBrush"
-                        Storyboard.TargetProperty="EndPoint"
-                        From="0,0"
-                        To="1888,560"
-                        Duration="0:0:1" />
-                </Storyboard>
-            </BeginStoryboard>
-            <BeginStoryboard>
-                <Storyboard RepeatBehavior="Forever" Duration="0:0:5">
-                    <PointAnimation
-                        Storyboard.TargetName="uxDatetimeLightBrush"
-                        Storyboard.TargetProperty="StartPoint"
-                        From="-50,-50"
-                        To="943,230"
-                        Duration="0:0:1" />
-                    <PointAnimation
-                        Storyboard.TargetName="uxDatetimeLightBrush"
-                        Storyboard.TargetProperty="EndPoint"
-                        From="0,0"
-                        To="993,280"
-                        Duration="0:0:1" />
-                </Storyboard>
-            </BeginStoryboard>
             <BeginStoryboard>
                 <Storyboard RepeatBehavior="Forever">
                     <Storyboard BeginTime="0:0:10">
@@ -122,404 +90,418 @@
                 RenderOptions.BitmapScalingMode="HighQuality"
                 Source="pack://application:,,,/Bellwether;component/Images/0_bg.png"
                 Stretch="Fill" />
+            <Image
+                x:Name="uxBg"
+                VerticalAlignment="Top"
+                HorizontalAlignment="Left"
+                Width="1920"
+                Height="1080"
+                Source="pack://application:,,,/Bellwether;component/Images/bg.png"
+                />
+            <Image
+                x:Name="uxTest"
+                VerticalAlignment="Top"
+                HorizontalAlignment="Left"
+                Width="1920"
+                Height="1080"
+                Opacity="0"
+                Source="pack://application:,,,/Bellwether;component/Images/Final Solar_Show3.png"/>
             <Grid
-                Width="943"
-                Height="230"
+                Width="575"
+                Height="182"
                 Margin="53,0,0,0"
                 HorizontalAlignment="Left"
                 VerticalAlignment="Top">
-                <Image Source="pack://application:,,,/Bellwether;component/Images/date_panel.png" />
-                <Image Source="pack://application:,,,/Bellwether;component/Images/date_panel_effect.png">
-                    <Image.OpacityMask>
-                        <LinearGradientBrush x:Name="uxDatetimeLightBrush" MappingMode="Absolute" StartPoint="100,100" EndPoint="150,150">
-                            <GradientStop Offset="0" Color="#00000000" />
-                            <GradientStop Offset="0.4" Color="#DD000000" />
-                            <GradientStop Offset="0.5" Color="#DD000000" />
-                            <GradientStop Offset="1" Color="#00000000" />
-                        </LinearGradientBrush>
-                    </Image.OpacityMask>
-                </Image>
                 <uicomponent:SpacedLabel
                     x:Name="uxDate"
-                    Margin="88,47,0,0"
-                    Text="2021/12/05"
-                    FontSize="48"
-                    FontFamily="Arial"
-                    Spaceing="-5" />
+                    Margin="25,3,64,43"
+                    Text="2021.12.05"
+                    FontSize="47"
+                    FontFamily="Microsoft JhengHei"
+                    Spaceing="-11" />
                 <uicomponent:SpacedLabel
                     x:Name="uxWeek"
-                    Margin="88,104,0,0"
+                    Margin="24,63,63,41"
                     Text="星期日"
-                    FontSize="40"
+                    FontSize="42"
                     FontFamily="Microsoft JhengHei UI"
-                    Spaceing="-6" />
+                    Spaceing="-7" />
                 <uicomponent:SpacedLabel
                     x:Name="uxTime"
-                    Margin="424,35,0,0"
+                    Margin="289,-1,0,36"
                     Text="09:54"
-                    FontSize="100"
-                    FontFamily="Arial"
+                    FontSize="89"
                     FontWeight="Bold"
-                    Spaceing="0" />
+                    FontFamily="Microsoft JhengHei"
+                    Spaceing="-13" />
             </Grid>
-            <Grid HorizontalAlignment="Left" VerticalAlignment="Bottom">
+            <Grid Margin="765,-8,0,0" HorizontalAlignment="Left" VerticalAlignment="Top">
                 <uicomponent:SpacedLabel
-                    Margin="71,0,0,690"
-                    HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom"
-                    Text="太陽能監控系統"
-                    FontSize="90"
-                    FontFamily="Microsoft JhengHei UI"
+                    x:Name="uxTitleText1"
+                    Margin="0,0,0,0"
+                    Text="一二集團參訪人數量"
+                    FontSize="80"
                     FontWeight="Bold"
-                    Spaceing="26">
-                    <uicomponent:SpacedLabel.BitmapEffect>
-                        <DropShadowBitmapEffect />
-                    </uicomponent:SpacedLabel.BitmapEffect>
-                </uicomponent:SpacedLabel>
-                <Image
-                    Width="1788"
-                    Height="460"
-                    Margin="68,0,-8,207"
-                    HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom"
-                    Source="pack://application:,,,/Bellwether;component/Images/SolarMonitor/solar_panel.png" />
-                <Image
-                    Width="1788"
-                    Height="460"
-                    Margin="68,0,-8,207"
-                    HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom"
-                    Source="pack://application:,,,/Bellwether;component/Images/SolarMonitor/solar_panel_effect.png">
-                    <Image.OpacityMask>
-                        <LinearGradientBrush x:Name="uxSolarEnergyLightBrush" MappingMode="Absolute" StartPoint="300.0,300.0" EndPoint="400,400">
-                            <GradientStop Offset="0" Color="#00000000" />
-                            <GradientStop Offset="0.425" Color="#DD000000" />
-                            <GradientStop Offset="0.475" Color="#DD000000" />
-                            <GradientStop Offset="1" Color="#00000000" />
-                        </LinearGradientBrush>
-                    </Image.OpacityMask>
-                </Image>
-                <Image
-                    Width="80"
-                    Height="80"
-                    Margin="964,0,0,649"
-                    HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom"
-                    Source="pack://application:,,,/Bellwether;component/Images/SolarMonitor/solar_icon1.png" />
-                <Image
-                    Width="70"
-                    Height="70"
-                    Margin="116,238,777,516"
-                    HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom"
-                    Source="pack://application:,,,/Bellwether;component/Images/SolarMonitor/solar_icon1.png" />
-                <Image
-                    Width="60"
-                    Height="60"
-                    Margin="116,0,0,426"
-                    HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom"
-                    Source="pack://application:,,,/Bellwether;component/Images/SolarMonitor/solar_icon3.png" />
-                <Image
-                    Width="60"
-                    Height="60"
-                    Margin="121,436,782,328"
-                    HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom"
-                    Source="pack://application:,,,/Bellwether;component/Images/SolarMonitor/solar_icon4.png" />
-                <Image
-                    Width="70"
-                    Height="70"
-                    Margin="974,0,0,470"
-                    HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom"
-                    Source="pack://application:,,,/Bellwether;component/Images/SolarMonitor/solar_icon1.png" />
-                <Image
-                    Width="60"
-                    Height="60"
-                    Margin="973,0,0,379"
-                    HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom"
-                    Source="pack://application:,,,/Bellwether;component/Images/SolarMonitor/solar_icon3.png" />
-                <Image
-                    Width="60"
-                    Height="60"
-                    Margin="978,0,0,281"
-                    HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom"
-                    Source="pack://application:,,,/Bellwether;component/Images/SolarMonitor/solar_icon4.png" />
-                <Image
-                    Width="488"
-                    Height="60"
-                    Margin="1245,0,0,662"
-                    HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom"
-                    Source="pack://application:,,,/Bellwether;component/Images/SolarMonitor/solar_text_bg_l.png"
-                    Stretch="Fill" />
-                <Image
-                    Width="263"
-                    Height="60"
-                    Margin="428,0,0,526"
-                    HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom"
-                    Source="pack://application:,,,/Bellwether;component/Images/SolarMonitor/solar_text_bg_s.png" />
-                <Image
-                    Width="263"
-                    Height="60"
-                    Margin="429,0,0,426"
-                    HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom"
-                    Source="pack://application:,,,/Bellwether;component/Images/SolarMonitor/solar_text_bg_s.png" />
-                <Image
-                    Width="263"
-                    Height="60"
-                    Margin="429,0,0,329"
-                    HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom"
-                    Source="pack://application:,,,/Bellwether;component/Images/SolarMonitor/solar_text_bg_s.png" />
-                <uicomponent:SpacedLabel
-                    Margin="1031,0,0,660"
-                    HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom"
-                    Text="裝置容量"
-                    FontSize="44"
-                    FontFamily="Microsoft JhengHei UI"
+                    FontFamily="Microsoft JhengHei"
                     Spaceing="-10" />
                 <uicomponent:SpacedLabel
-                    Width="200"
-                    Margin="182,0,0,529"
-                    HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom"
-                    Text="今日發電量"
-                    FontSize="34"
-                    FontFamily="Microsoft JhengHei UI"
-                    Spaceing="-12" />
-                <uicomponent:SpacedLabel
-                    Margin="182,0,0,428"
-                    HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom"
-                    Text="今日減碳量"
-                    FontSize="34"
-                    FontFamily="Microsoft JhengHei UI"
-                    Spaceing="-12" />
-                <uicomponent:SpacedLabel
-                    Margin="182,0,0,330"
-                    HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom"
-                    Text="今日造林效益值"
-                    FontSize="34"
-                    FontFamily="Microsoft JhengHei UI"
-                    Spaceing="-12" />
-
-                <uicomponent:SpacedLabel
-                    Width="200"
-                    Margin="1040,0,0,482"
-                    HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom"
-                    Text="今年發電量"
-                    FontSize="34"
-                    FontFamily="Microsoft JhengHei UI"
-                    Spaceing="-12" />
-                <uicomponent:SpacedLabel
-                    Margin="1039,0,0,380"
-                    HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom"
-                    Text="今年減碳量"
-                    FontSize="34"
-                    FontFamily="Microsoft JhengHei UI"
-                    Spaceing="-12" />
-                <uicomponent:SpacedLabel
-                    Margin="1039,0,0,283"
-                    HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom"
-                    Text="今年造林效益值"
-                    FontSize="34"
-                    FontFamily="Microsoft JhengHei UI"
-                    Spaceing="-12" />
-                <uicomponent:SpacedLabel
-                    Margin="1744,0,0,660"
-                    HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom"
-                    Text="kWp"
-                    FontSize="44"
-                    FontFamily="Microsoft JhengHei UI"
+                    x:Name="uxTitleText2"
+                    Margin="0,77,0,13"
+                    Text="一二集團參訪國別量"
+                    FontSize="80"
+                    FontWeight="Bold"
+                    FontFamily="Microsoft JhengHei"
                     Spaceing="-10" />
                 <uicomponent:SpacedLabel
-                    Margin="700,0,0,428"
-                    HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom"
-                    Text="公斤(kg)"
-                    FontSize="34"
-                    FontFamily="Microsoft JhengHei UI"
-                    Spaceing="-9" />
-                <uicomponent:SpacedLabel
-                    Width="130"
-                    Margin="701,0,0,529"
-                    HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom"
-                    Text="kWh"
-                    FontSize="34"
-                    FontFamily="Microsoft JhengHei UI"
+                    x:Name="uxTitleNNum1"
+                    Margin="740,0,0,0"
+                    Text="12345678"
+                    FontSize="80"
+                    FontWeight="Bold"
+                    FontFamily="Microsoft JhengHei"
                     Spaceing="-10" />
                 <uicomponent:SpacedLabel
-                    Margin="702,0,0,330"
-                    HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom"
-                    Text="棵樹日減碳量"
-                    FontSize="34"
-                    FontFamily="Microsoft JhengHei UI"
-                    Spaceing="-12" />
+                    x:Name="uxTitleNNum2"
+                    Margin="739,77,1,13"
+                    Text="1,234/567"
+                    FontSize="80"
+                    FontWeight="Bold"
+                    FontFamily="Microsoft JhengHei"
+                    Spaceing="-10" />
+            </Grid>
+            <Grid Margin="0,383,0,0" HorizontalAlignment="Left" Width="1920">
+                <Grid x:Name="uxSolarPrimaryForm" Height="125" VerticalAlignment="Top" Margin="100,65,0,190">
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition Width="206"/>
+                        <ColumnDefinition Width="186"/>
+                        <ColumnDefinition Width="253"/>
+                        <ColumnDefinition Width="429"/>
+                        <ColumnDefinition Width="531"/>
+                    </Grid.ColumnDefinitions>
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="*"/>
+                        <RowDefinition Height="*"/>
+                    </Grid.RowDefinitions>
+                    <uicomponent:SpacedLabel
+                        x:Name="uxPrimarySolarInfo00"
+                        Text="集團"
+                        FontWeight="Bold"
+                        FontSize="43"
+                        FontColor="White"
+                        HorizontalAlignment="Center"
+                        FontFamily="Microsoft JhengHei"
+                        VerticalAlignment="Center"
+                        Spaceing="-10" />
+                    <uicomponent:SpacedLabel
+                        x:Name="uxPrimarySolarInfo10"
+                        Grid.Row="1"
+                        Text="集團"
+                        FontSize="43"
+                        FontWeight="Bold"
+                        FontColor="White"
+                        HorizontalAlignment="Center"
+                        FontFamily="Microsoft JhengHei"
+                        VerticalAlignment="Center"
+                        Spaceing="-10" />
+                    <uicomponent:SpacedLabel
+                        x:Name="uxPrimarySolarInfo01"
+                        Grid.Column="1"
+                        Text="年"
+                        FontWeight="Bold"
+                        FontSize="44"
+                        FontColor="White"
+                        HorizontalAlignment="Center"
+                        FontFamily="Microsoft JhengHei"
+                        VerticalAlignment="Center"
+                        Spaceing="-10" />
+                    <uicomponent:SpacedLabel
+                        x:Name="uxPrimarySolarInfo11"
+                        Grid.Row="1"
+                        Grid.Column="1"
+                        Text="日"
+                        FontWeight="Bold"
+                        FontSize="44"
+                        FontColor="White"
+                        HorizontalAlignment="Center"
+                        FontFamily="Microsoft JhengHei"
+                        VerticalAlignment="Center"
+                        Spaceing="-10" />
+                    <uicomponent:SpacedLabel
+                        x:Name="uxPrimarySolarInfo02"
+                        Grid.Column="2"
+                        Text="424,519"
+                        FontSize="45"
+                        FontColor="White"
+                        HorizontalAlignment="Right"
+                        FontFamily="Microsoft JhengHei"
+                        VerticalAlignment="Center"
+                        Spaceing="-10"/>
+                    <uicomponent:SpacedLabel
+                        x:Name="uxPrimarySolarInfo12"
+                        Grid.Row="1"
+                        Grid.Column="2"
+                        Text="2,637"
+                        FontSize="45"
+                        FontColor="White"
+                        HorizontalAlignment="Right"
+                        FontFamily="Microsoft JhengHei"
+                        VerticalAlignment="Center"
+                        Spaceing="-10" />
+                    <uicomponent:SpacedLabel
+                        x:Name="uxPrimarySolarInfo03"
+                        Grid.Column="3"
+                        Text="205,836"
+                        FontSize="45"
+                        FontColor="White"
+                        HorizontalAlignment="Right"
+                        FontFamily="Microsoft JhengHei"
+                        VerticalAlignment="Center"
+                        Spaceing="-10" />
+                    <uicomponent:SpacedLabel
+                        x:Name="uxPrimarySolarInfo13"
+                        Grid.Row="1"
+                        Grid.Column="3"
+                        Text="2,688"
+                        FontSize="45"
+                        FontColor="White"
+                        HorizontalAlignment="Right"
+                        FontFamily="Microsoft JhengHei"
+                        VerticalAlignment="Center"
+                        Spaceing="-10" />
+                    <uicomponent:SpacedLabel
+                        x:Name="uxPrimarySolarInfo04"
+                        Grid.Column="4"
+                        Text="2,983,510"
+                        FontSize="45"
+                        FontColor="White"
+                        HorizontalAlignment="Right"
+                        FontFamily="Microsoft JhengHei"
+                        VerticalAlignment="Center"
+                        Spaceing="-10" />
+                    <uicomponent:SpacedLabel
+                        x:Name="uxPrimarySolarInfo14"
+                        Grid.Row="1"
+                        Grid.Column="4"
+                        Text="26,612"
+                        FontSize="45"
+                        FontColor="White"
+                        HorizontalAlignment="Right"
+                        FontFamily="Microsoft JhengHei"
+                        VerticalAlignment="Center"
+                        Spaceing="-10" />
+                </Grid>
+                <Grid x:Name="uxSolarSecondaryForm" Margin="100,250,0,0" VerticalAlignment="Top" Height="260">
+                    <Grid.ColumnDefinitions>
+                        <ColumnDefinition Width="206"/>
+                        <ColumnDefinition Width="186"/>
+                        <ColumnDefinition Width="253"/>
+                        <ColumnDefinition Width="429"/>
+                        <ColumnDefinition Width="531"/>
+                    </Grid.ColumnDefinitions>
+                    <Grid.RowDefinitions>
+                        <RowDefinition Height="*"/>
+                        <RowDefinition Height="*" />
+                        <RowDefinition Height="*" />
+                        <RowDefinition Height="*" />
+                        <RowDefinition Height="*" />
+                    </Grid.RowDefinitions>
+                    <uicomponent:SpacedLabel
+                        Text="平鎮"
+                        FontWeight="Bold"
+                        FontSize="43"
+                        Margin="0,-10,0,0"
+                        Foreground="White"
+                        HorizontalAlignment="Center"
+                        FontFamily="Microsoft JhengHei"
+                        Spaceing="-10" />
+                    <uicomponent:SpacedLabel
+                        Grid.Row="1"
+                        Text="崑山"
+                        FontSize="43"
+                        FontWeight="Bold"
+                        Margin="0,-10,0,0"
+                        Foreground="White"
+                        HorizontalAlignment="Center"
+                        FontFamily="Microsoft JhengHei"
+                        Spaceing="-10" />
+                    <uicomponent:SpacedLabel
+                        Grid.Row="2"
+                        Text="越南"
+                        FontSize="43"
+                        FontWeight="Bold"
+                        Margin="0,-10,0,0"
+                        Foreground="White"
+                        HorizontalAlignment="Center"
+                        FontFamily="Microsoft JhengHei"
+                        Spaceing="-10" />
+                    <uicomponent:SpacedLabel
+                        Grid.Row="3"
+                        Text="美洲"
+                        FontSize="43"
+                        Margin="0,-10,0,0"
+                        FontWeight="Bold"
+                        Foreground="White"
+                        HorizontalAlignment="Center"
+                        FontFamily="Microsoft JhengHei"
+                        Spaceing="-10" />
+                    <uicomponent:SpacedLabel
+                        Grid.Column="1"
+                        Grid.Row="0"
+                        Text="日"
+                        FontSize="43"
+                        Margin="0,-10,0,0"
+                        FontWeight="Bold"
+                        Foreground="White"
+                        HorizontalAlignment="Center"
+                        FontFamily="Microsoft JhengHei"
+                        Spaceing="-10" />
+                    <uicomponent:SpacedLabel
+                        Grid.Column="2"
+                        Grid.Row="0"
+                        Text="1,488"
+                        FontSize="45"
+                        Margin="0,-10,0,0"
+                        Foreground="White"
+                        HorizontalAlignment="Right"
+                        FontFamily="Microsoft JhengHei"
+                        Spaceing="-10" />
+                    <uicomponent:SpacedLabel
+                        Grid.Column="3"
+                        Grid.Row="0"
+                        Text="123"
+                        FontSize="45"
+                        Margin="0,-10,0,0"
+                        Foreground="White"
+                        HorizontalAlignment="Right"
+                        FontFamily="Microsoft JhengHei"
+                        Spaceing="-10" />
+                    <uicomponent:SpacedLabel
+                        Grid.Column="4"
+                        Grid.Row="0"
+                        Text="26,611"
+                        FontSize="45"
+                        Margin="0,-10,0,0"
+                        Foreground="White"
+                        HorizontalAlignment="Right"
+                        FontFamily="Microsoft JhengHei"
+                        Spaceing="-10" />
+                </Grid>
+            </Grid>
+            <Grid VerticalAlignment="Bottom" HorizontalAlignment="Left"
+                  Margin="379,0,0,115"
+                  Width="1000">
                 <uicomponent:SpacedLabel
-                    Margin="1558,0,0,381"
+                    Text="裝置容量(kWp)"
+                    FontSize="35"
+                    FontWeight="Bold"
+                    FontColor="#254298"
+                    Margin="0,-5,0,0"
                     HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom"
-                    Text="公斤(kg)"
-                    FontSize="34"
-                    FontFamily="Microsoft JhengHei UI"
-                    Spaceing="-9" />
+                    FontFamily="Microsoft JhengHei"
+                    Spaceing="-10" />
+                <Grid x:Name="uxSolarCapacityPanel" Margin="270,0,-333,0">
+                    <Grid>
+                        <Grid.ColumnDefinitions>
+                            <ColumnDefinition Width="Auto"/>
+                            <ColumnDefinition Width="30"/>
+                            <ColumnDefinition Width="Auto"/>
+                        </Grid.ColumnDefinitions>
+                        <uicomponent:SpacedLabel
+                            Text="平鎮"
+                            FontSize="35"
+                            FontWeight="Bold"
+                            FontColor="#254298"
+                            FontFamily="Microsoft JhengHei"
+                            Spaceing="-10" />
+                        <uicomponent:SpacedLabel
+                            Grid.Column="1"
+                            Text="▸"
+                            FontSize="35"
+                            Margin="-5,0,0,0"
+                            FontColor="#0068E8"
+                            FontFamily="Microsoft JhengHei"
+                            Spaceing="-10" />
+                        <uicomponent:SpacedLabel
+                            Grid.Column="2"
+                            Text="573"
+                            FontSize="35"
+                            Margin="-7,0,0,0"
+                            FontColor="#0068E8"
+                            HorizontalAlignment="Left"
+                            FontFamily="Microsoft JhengHei"
+                            Spaceing="-10" />
+                    </Grid>
+                </Grid>
+            </Grid>
+            <Grid HorizontalAlignment="Left" VerticalAlignment="Bottom">
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="538*"/>
+                    <ColumnDefinition Width="329*"/>
+                </Grid.ColumnDefinitions>
                 <uicomponent:SpacedLabel
-                    Width="130"
-                    Margin="1558,0,0,482"
+                    Margin="652,-181,0,0"
                     HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom"
-                    Text="kWh"
-                    FontSize="34"
+                    VerticalAlignment="Top"
+                    Text="太陽能戰情"
+                    FontSize="98"
                     FontFamily="Microsoft JhengHei UI"
-                    Spaceing="-10" />
+                    FontWeight="Bold"
+                    Spaceing="14" Grid.ColumnSpan="2">
+                    <uicomponent:SpacedLabel.BitmapEffect>
+                        <DropShadowBitmapEffect />
+                    </uicomponent:SpacedLabel.BitmapEffect>
+                </uicomponent:SpacedLabel>
                 <uicomponent:SpacedLabel
-                    Margin="1559,0,0,282"
+                    Margin="84,-69,0,0"
                     HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom"
-                    Text="棵樹日減碳量"
-                    FontSize="34"
+                    VerticalAlignment="Top"
+                    Text="Solar Dashboard"
+                    FontSize="43"
                     FontFamily="Microsoft JhengHei UI"
-                    Spaceing="-12" />
-                <Image
-                    Width="263"
-                    Height="60"
-                    Margin="1282,0,0,479"
-                    HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom"
-                    Source="/Bellwether;component/Images/SolarMonitor/solar_text_bg_s.png" />
-                <Image
-                    Width="263"
-                    Height="60"
-                    Margin="1282,0,0,379"
-                    HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom"
-                    Source="/Bellwether;component/Images/SolarMonitor/solar_text_bg_s.png" />
-                <Image
-                    Width="263"
-                    Height="60"
-                    Margin="1282,0,0,282"
-                    HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom"
-                    Source="/Bellwether;component/Images/SolarMonitor/solar_text_bg_s.png" />
+                    FontWeight="Bold"
+                    Spaceing="-9" Grid.Column="1"/>
                 <Grid
                     Width="488"
                     Height="60"
-                    Margin="1245,0,0,662"
+                    Margin="169.5,0,0,662"
                     HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom">
-                    <uicomponent:SpacedLabel
-                        x:Name="uxCapacity"
-                        HorizontalAlignment="Center"
-                        VerticalAlignment="Center"
-                        Text="0000"
-                        FontSize="34"
-                        FontFamily="Microsoft JhengHei UI"
-                        Spaceing="-5" />
-                </Grid>
+                    VerticalAlignment="Bottom" Grid.Column="1"/>
                 <Grid
                     Width="263"
                     Height="60"
                     Margin="428,0,0,526"
                     HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom">
-                    <uicomponent:SpacedLabel
-                        x:Name="uxEnergy_Today"
-                        HorizontalAlignment="Center"
-                        VerticalAlignment="Center"
-                        Text="1234567890"
-                        FontSize="34"
-                        FontFamily="Microsoft JhengHei UI"
-                        Spaceing="-5" />
-                </Grid>
+                    VerticalAlignment="Bottom"/>
                 <Grid
                     Width="263"
                     Height="60"
                     Margin="429,0,0,426"
                     HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom">
-                    <uicomponent:SpacedLabel
-                        x:Name="uxCO2EmissionSaved_Today"
-                        HorizontalAlignment="Center"
-                        VerticalAlignment="Center"
-                        Text="0000"
-                        FontSize="34"
-                        FontFamily="Microsoft JhengHei UI"
-                        Spaceing="-5" />
-                </Grid>
+                    VerticalAlignment="Bottom"/>
                 <Grid
                     Width="263"
                     Height="60"
                     Margin="429,0,0,329"
                     HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom">
-                    <uicomponent:SpacedLabel
-                        x:Name="uxEquivalentTreesPlanted_Today"
-                        HorizontalAlignment="Center"
-                        VerticalAlignment="Center"
-                        Text="0000"
-                        FontSize="34"
-                        FontFamily="Microsoft JhengHei UI"
-                        Spaceing="-5" />
-                </Grid>
+                    VerticalAlignment="Bottom"/>
                 <Grid
                     Width="263"
                     Height="60"
-                    Margin="1282,0,0,479"
+                    Margin="206.5,0,0,479"
                     HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom">
-                    <uicomponent:SpacedLabel
-                        x:Name="uxEnergy_ThisYear"
-                        HorizontalAlignment="Center"
-                        VerticalAlignment="Center"
-                        Text="1234567890"
-                        FontSize="34"
-                        FontFamily="Microsoft JhengHei UI"
-                        Spaceing="-5" />
-                </Grid>
+                    VerticalAlignment="Bottom" Grid.Column="1"/>
                 <Grid
                     Width="263"
                     Height="60"
-                    Margin="1282,0,0,379"
+                    Margin="206.5,0,0,379"
                     HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom">
-                    <uicomponent:SpacedLabel
-                        x:Name="uxCO2EmissionSaved_ThisYear"
-                        HorizontalAlignment="Center"
-                        VerticalAlignment="Center"
-                        Text="85775.123"
-                        FontSize="34"
-                        FontFamily="Microsoft JhengHei UI"
-                        Spaceing="-5" />
-                </Grid>
+                    VerticalAlignment="Bottom" Grid.Column="1"/>
                 <Grid
                     Width="263"
                     Height="60"
-                    Margin="1282,0,0,282"
+                    Margin="206.5,0,0,282"
                     HorizontalAlignment="Left"
-                    VerticalAlignment="Bottom">
-                    <uicomponent:SpacedLabel
-                        x:Name="uxEquivalentTreesPlanted_ThisYear"
-                        HorizontalAlignment="Center"
-                        VerticalAlignment="Center"
-                        Text="0000"
-                        FontSize="34"
-                        FontFamily="Microsoft JhengHei UI"
-                        Spaceing="-5" />
-                </Grid>
+                    VerticalAlignment="Bottom" Grid.Column="1"/>
             </Grid>
             <Grid HorizontalAlignment="Left" VerticalAlignment="Top">
                 <Image
@@ -699,7 +681,7 @@
                 <Grid
                     Width="100"
                     Height="100"
-                    Margin="78,282,0,0"
+                    Margin="652,196,0,0"
                     HorizontalAlignment="Left"
                     VerticalAlignment="Top"
                     Background="Transparent"
@@ -708,7 +690,7 @@
                 <Grid
                     Width="100"
                     Height="100"
-                    Margin="207,280,0,0"
+                    Margin="782,194,0,0"
                     HorizontalAlignment="Left"
                     VerticalAlignment="Top"
                     Background="Transparent"
@@ -726,7 +708,7 @@
             <Grid
                 Width="100"
                 Height="100"
-                Margin="702,280,0,0"
+                Margin="1150,198,0,0"
                 HorizontalAlignment="Left"
                 VerticalAlignment="Top"
                 Background="Transparent"
@@ -735,7 +717,7 @@
             <Grid
                 Width="100"
                 Height="100"
-                Margin="830,277,0,0"
+                Margin="1024,195,0,0"
                 HorizontalAlignment="Left"
                 VerticalAlignment="Top"
                 Background="Transparent"

+ 244 - 21
Bellwether/Pages/ucFrontPage.xaml.cs

@@ -18,6 +18,8 @@ using System.Windows.Navigation;
 using System.Windows.Shapes;
 using System.Linq;
 using System.Globalization;
+using Bellwether.UIComponent;
+using System.IO;
 
 namespace Bellwether.Pages
 {
@@ -64,6 +66,19 @@ namespace Bellwether.Pages
             UpdateDateTimeInfo();
             SolarInfpoUpdateTimer.Start();
             DateTimeUpdateTimer.Start();
+
+            LoadSolarInfoBg();
+        }
+
+        private void LoadSolarInfoBg()
+        {
+            var bgFilePath = Properties.Settings.Default.SolarPanelBg;
+            if (!File.Exists(bgFilePath))
+            {
+                return;
+            }
+            bgFilePath = System.IO.Path.GetFullPath(bgFilePath);
+            uxBg.Source = Utility.GlobalFunction.GetBitMap(bgFilePath, 1920, 1080);
         }
 
         private void UcFrontPage_Unload(object sender, EventArgs e)
@@ -88,41 +103,181 @@ namespace Bellwether.Pages
 
         private void UpdateSolarInfo()
         {
-            var solarInfo = GetSolarInfo();
+            UpdateTitlePanel();
+            UpdateSolarEnergyPanel();
+            UpdateSolarCapacityPanel();
+        }
 
-            if (solarInfo is null)
+        private async Task UpdateSolarCapacityPanel()
+        {
+            var energyCapacity = await BellwetherAPI.GetSolarenergyCapacity();
+
+            uxSolarCapacityPanel.Children.Clear();
+            uxSolarCapacityPanel.ColumnDefinitions.Clear();
+
+            var total = energyCapacity.Count;
+            if (total <= 0)
+                return;
+
+            if (total == 1)
             {
-                DisplayEmptySolarInfo();
+                AddSingalSolarCapacity(energyCapacity[0]);
                 return;
             }
-            DisplaySolarInfo(solarInfo);
+
+            if (total == 2)
+            {
+                uxSolarCapacityPanel.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) });
+                uxSolarCapacityPanel.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
+                uxSolarCapacityPanel.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) });
+                uxSolarCapacityPanel.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
+                uxSolarCapacityPanel.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) });
+
+                var firstElemnt = CreateEnergyCapacityInfoPanel(energyCapacity[0]);
+                Grid.SetColumn(firstElemnt, 1);
+                uxSolarCapacityPanel.Children.Add(firstElemnt);
+
+                var secondElemnt = CreateEnergyCapacityInfoPanel(energyCapacity[1]);
+                Grid.SetColumn(secondElemnt, 3);
+                uxSolarCapacityPanel.Children.Add(secondElemnt);
+
+                return;
+            }
+
+
+            uxSolarCapacityPanel.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
+            for (int colIndex = 1; colIndex < total; colIndex++)
+            {
+                uxSolarCapacityPanel.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) });
+                uxSolarCapacityPanel.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
+            }
+
+            for (int dataIndex = 0; dataIndex < total; dataIndex++)
+            {
+                var panel = CreateEnergyCapacityInfoPanel(energyCapacity[dataIndex]);
+                Grid.SetColumn(panel, dataIndex * 2);
+                uxSolarCapacityPanel.Children.Add(panel);
+            }
         }
 
-        private void DisplayEmptySolarInfo()
+        private void AddSingalSolarCapacity(Model.SolarenergyCapacityModel solarenergyCapacityModel)
         {
-            const string emptyNumber = "---";
-            uxCapacity.Text = emptyNumber;
+            uxSolarCapacityPanel.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) });
+            uxSolarCapacityPanel.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
+            uxSolarCapacityPanel.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) });
 
-            uxEnergy_Today.Text = emptyNumber;
-            uxCO2EmissionSaved_Today.Text = emptyNumber;
-            uxEquivalentTreesPlanted_Today.Text = emptyNumber;
+            var infoPanel = CreateEnergyCapacityInfoPanel(solarenergyCapacityModel);
+            Grid.SetColumn(infoPanel, 1);
+            uxSolarCapacityPanel.Children.Add(infoPanel);
+        }
 
-            uxEnergy_ThisYear.Text = emptyNumber;
-            uxCO2EmissionSaved_ThisYear.Text = emptyNumber;
-            uxEquivalentTreesPlanted_ThisYear.Text = emptyNumber;
+        private async Task UpdateSolarEnergyPanel()
+        {
+            var solarEnergyInfo = await BellwetherAPI.GetSolarenergy();
+            var primary = solarEnergyInfo.Take(2).ToList();
+            var secondary = solarEnergyInfo.Skip(2).ToList();
+            UpdateSolarEnergyPrimaryPanel(primary);
+            UpdateSolarEnergySecondaryPanel(secondary);
         }
 
-        private void DisplaySolarInfo(SolarInfoModel solarInfo)
+        private void UpdateSolarEnergyPrimaryPanel(List<Model.SolarEnergyModel> primary)
         {
-            uxCapacity.Text = solarInfo.Capacity.ToString();
+            if (primary.Count > 0)
+            {
+                var p1 = primary[0];
+                uxPrimarySolarInfo00.Text = p1.Area;
+                uxPrimarySolarInfo01.Text = p1.Unit;
+                uxPrimarySolarInfo02.Text = p1.Energy;
+                uxPrimarySolarInfo03.Text = p1.CO2EmissionSaved;
+                uxPrimarySolarInfo04.Text = p1.EquivalentTreesPlanted;
+            }
+            else
+            {
+                uxPrimarySolarInfo00.Text = "";
+                uxPrimarySolarInfo01.Text = "";
+                uxPrimarySolarInfo02.Text = "";
+                uxPrimarySolarInfo03.Text = "";
+                uxPrimarySolarInfo04.Text = "";
+            }
 
-            uxEnergy_Today.Text = solarInfo.Energy_Today.ToString("#,##0");
-            uxCO2EmissionSaved_Today.Text = solarInfo.CO2EmissionSaved_Today.ToString("#,##0");
-            uxEquivalentTreesPlanted_Today.Text = ((int)solarInfo.EquivalentTreesPlanted_Today).ToString("#,##0");
+            if (primary.Count > 1)
+            {
+                var p2 = primary[1];
+                uxPrimarySolarInfo10.Text = p2.Area;
+                uxPrimarySolarInfo11.Text = p2.Unit;
+                uxPrimarySolarInfo12.Text = p2.Energy;
+                uxPrimarySolarInfo13.Text = p2.CO2EmissionSaved;
+                uxPrimarySolarInfo14.Text = p2.EquivalentTreesPlanted;
+            }
+            else
+            {
+                uxPrimarySolarInfo10.Text = "";
+                uxPrimarySolarInfo11.Text = "";
+                uxPrimarySolarInfo12.Text = "";
+                uxPrimarySolarInfo13.Text = "";
+                uxPrimarySolarInfo14.Text = "";
+            }
+        }
 
-            uxEnergy_ThisYear.Text = solarInfo.Energy_ThisYear.ToString("#,##0");
-            uxCO2EmissionSaved_ThisYear.Text = solarInfo.CO2EmissionSaved_ThisYear.ToString("#,##0");
-            uxEquivalentTreesPlanted_ThisYear.Text = (solarInfo.EquivalentTreesPlanted_ThisYear * 360 * 1000).ToString("#,##0");
+        private void UpdateSolarEnergySecondaryPanel(List<Model.SolarEnergyModel> secondaryDatas)
+        {
+            const int MAX_ROW = 5;
+            uxSolarSecondaryForm.Children.Clear();
+            for (int dataIndex = 0; dataIndex < secondaryDatas.Count && dataIndex < MAX_ROW; dataIndex++)
+            {
+                var data = secondaryDatas[dataIndex];
+
+                var area = CreateSolarEnergySecondaryInfo(data.Area, isTitle: true);
+                Grid.SetColumn(area, 0);
+                Grid.SetRow(area, dataIndex);
+                uxSolarSecondaryForm.Children.Add(area);
+
+                var unit = CreateSolarEnergySecondaryInfo(data.Unit, isTitle: true);
+                Grid.SetColumn(unit, 1);
+                Grid.SetRow(unit, dataIndex);
+                uxSolarSecondaryForm.Children.Add(unit);
+
+                var energy = CreateSolarEnergySecondaryInfo(data.Energy);
+                Grid.SetColumn(energy, 2);
+                Grid.SetRow(energy, dataIndex);
+                uxSolarSecondaryForm.Children.Add(energy);
+
+                var co2 = CreateSolarEnergySecondaryInfo(data.CO2EmissionSaved);
+                Grid.SetColumn(co2, 3);
+                Grid.SetRow(co2, dataIndex);
+                uxSolarSecondaryForm.Children.Add(co2);
+
+                var trees = CreateSolarEnergySecondaryInfo(data.EquivalentTreesPlanted);
+                Grid.SetColumn(trees, 4);
+                Grid.SetRow(trees, dataIndex);
+                uxSolarSecondaryForm.Children.Add(trees);
+            }
+        }
+
+        private async Task UpdateTitlePanel()
+        {
+            var titleInfo1 = await BellwetherAPI.GetSolarenergyTitle1();
+            if (!string.IsNullOrEmpty(titleInfo1.Title))
+            {
+                uxTitleText1.Text = titleInfo1.Title;
+                uxTitleNNum1.Text = titleInfo1.Content.ToString();
+            }
+            else
+            {
+                uxTitleText1.Text = "";
+                uxTitleNNum1.Text = "";
+            }
+            var titleInfo2 = await BellwetherAPI.GetSolarenergyTitle2();
+            if (!string.IsNullOrEmpty(titleInfo2.Title))
+            {
+                uxTitleText2.Text = titleInfo2.Title;
+                uxTitleNNum2.Text = titleInfo2.Content.ToString();
+            }
+            else
+            {
+                uxTitleText2.Text = "";
+                uxTitleNNum2.Text = "";
+            }
         }
 
         private void UpdateDateTimeInfo()
@@ -292,6 +447,74 @@ namespace Bellwether.Pages
                 };
             }
         }
+
+        private UIElement CreateSolarEnergySecondaryInfo(string data, bool isTitle = false)
+        {
+            var dataString = data;
+            dataString = string.IsNullOrEmpty(dataString) ? " " : dataString;
+            return new SpacedLabel()
+            {
+                Text = dataString,
+                FontSize = 43,
+                Margin = new Thickness(0, -10, 0, 0),
+                FontWeight = isTitle ? FontWeights.Bold : FontWeights.Normal,
+                FontColor = Colors.White,
+                HorizontalAlignment = isTitle ? HorizontalAlignment.Center : HorizontalAlignment.Right,
+                FontFamily = new FontFamily("Microsoft JhengHei"),
+                Spaceing = -10
+            };
+        }
+
+        private UIElement CreateEnergyCapacityInfoPanel(Model.SolarenergyCapacityModel solarenergyCapacityModel)
+        {
+            Grid rootGrid = new Grid();
+            rootGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
+            rootGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(30, GridUnitType.Pixel) });
+            rootGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });
+
+            var area = solarenergyCapacityModel.Area;
+            area = string.IsNullOrEmpty(area) ? " " : area;
+            var title = new SpacedLabel()
+            {
+                Text = area,
+                FontSize = 35,
+                Margin = new Thickness(-10, 0, 0, 0),
+                FontWeight = FontWeights.Bold,
+                FontColor = Color.FromRgb(37, 66, 152),
+                FontFamily = new FontFamily("Microsoft JhengHei"),
+                Spaceing = -10
+            };
+            Grid.SetColumn(title, 0);
+            rootGrid.Children.Add(title);
+
+            var arror = new SpacedLabel()
+            {
+                Text = "▸",
+                Margin = new Thickness(-5, 0, 0, 0),
+                FontSize = 35,
+                FontColor = Color.FromRgb(0, 104, 232),
+                FontFamily = new FontFamily("Microsoft JhengHei"),
+                Spaceing = -10
+            };
+            Grid.SetColumn(arror, 1);
+            rootGrid.Children.Add(arror);
+
+            var capacity = solarenergyCapacityModel.Capacity;
+            capacity = string.IsNullOrEmpty(capacity) ? " " : capacity;
+            var capacityLabel = new SpacedLabel()
+            {
+                Margin = new Thickness(-7, 0, 0, 0),
+                Text = capacity,
+                FontSize = 35,
+                FontColor = Color.FromRgb(0, 104, 232),
+                FontFamily = new FontFamily("Microsoft JhengHei"),
+                Spaceing = -10
+            };
+            Grid.SetColumn(capacityLabel, 2);
+            rootGrid.Children.Add(capacityLabel);
+
+            return rootGrid;
+        }
     }
 
     public class SolarInfoModel

+ 60 - 0
Bellwether/Properties/Settings.Designer.cs

@@ -58,5 +58,65 @@ namespace Bellwether.Properties {
                 this["Screensaver"] = value;
             }
         }
+        
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("bg.png")]
+        public string SolarPanelBg {
+            get {
+                return ((string)(this["SolarPanelBg"]));
+            }
+            set {
+                this["SolarPanelBg"] = value;
+            }
+        }
+        
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("http://plm.bellwether-corp.com:8081/BW_Service.asmx/ExportSolarenergy_All_1")]
+        public string SolarEnergyUrl {
+            get {
+                return ((string)(this["SolarEnergyUrl"]));
+            }
+            set {
+                this["SolarEnergyUrl"] = value;
+            }
+        }
+        
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("http://plm.bellwether-corp.com:8081/BW_Service.asmx/ExportSolarenergy_All_2")]
+        public string SolarCapacityUrl {
+            get {
+                return ((string)(this["SolarCapacityUrl"]));
+            }
+            set {
+                this["SolarCapacityUrl"] = value;
+            }
+        }
+        
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("http://plm.bellwether-corp.com:8081/BW_Service.asmx/ExportSolarenergy_All_3")]
+        public string TitleTextUrl1 {
+            get {
+                return ((string)(this["TitleTextUrl1"]));
+            }
+            set {
+                this["TitleTextUrl1"] = value;
+            }
+        }
+        
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("http://plm.bellwether-corp.com:8081/BW_Service.asmx/ExportSolarenergy_All_4")]
+        public string TitleTextUrl2 {
+            get {
+                return ((string)(this["TitleTextUrl2"]));
+            }
+            set {
+                this["TitleTextUrl2"] = value;
+            }
+        }
     }
 }

+ 15 - 0
Bellwether/Properties/Settings.settings

@@ -11,5 +11,20 @@
     <Setting Name="Screensaver" Type="System.String" Scope="User">
       <Value Profile="(Default)">D:\RobertProject\Bellwether\Project\Bellwether\bin\Debug\Ribbons.scr</Value>
     </Setting>
+    <Setting Name="SolarPanelBg" Type="System.String" Scope="User">
+      <Value Profile="(Default)">bg.png</Value>
+    </Setting>
+    <Setting Name="SolarEnergyUrl" Type="System.String" Scope="User">
+      <Value Profile="(Default)">http://plm.bellwether-corp.com:8081/BW_Service.asmx/ExportSolarenergy_All_1</Value>
+    </Setting>
+    <Setting Name="SolarCapacityUrl" Type="System.String" Scope="User">
+      <Value Profile="(Default)">http://plm.bellwether-corp.com:8081/BW_Service.asmx/ExportSolarenergy_All_2</Value>
+    </Setting>
+    <Setting Name="TitleTextUrl1" Type="System.String" Scope="User">
+      <Value Profile="(Default)">http://plm.bellwether-corp.com:8081/BW_Service.asmx/ExportSolarenergy_All_3</Value>
+    </Setting>
+    <Setting Name="TitleTextUrl2" Type="System.String" Scope="User">
+      <Value Profile="(Default)">http://plm.bellwether-corp.com:8081/BW_Service.asmx/ExportSolarenergy_All_4</Value>
+    </Setting>
   </Settings>
 </SettingsFile>

+ 16 - 1
Bellwether/UIComponent/SpacedLabel.xaml.cs

@@ -67,13 +67,28 @@ namespace Bellwether.UIComponent
             }
         }
 
+        private Color fontColor = Colors.White;
+        public Color FontColor
+        {
+            get => fontColor;
+            set
+            {
+                if (fontColor == value)
+                {
+                    return;
+                }
+                fontColor = value;
+                uxControl.ItemTemplate = new DataTemplate(typeof(Label)) { VisualTree = GetVisualTree() };
+            }
+        }
+
         private FrameworkElementFactory GetVisualTree()
         {
             FrameworkElementFactory factory = new FrameworkElementFactory(typeof(Label));
             factory.SetValue(Label.FontSizeProperty, FontSize);
             factory.SetValue(Label.FontFamilyProperty, FontFamily);
             factory.SetValue(Label.FontWeightProperty, FontWeight);
-            factory.SetValue(Label.ForegroundProperty, Brushes.White);
+            factory.SetValue(Label.ForegroundProperty, new SolidColorBrush(fontColor));
             factory.SetValue(Label.MarginProperty, new Thickness(0,0, spaceing, 0));
             factory.SetBinding(Label.ContentProperty,new Binding());
             return factory;