Browse Source

add solar energy url as setting

Robert 3 years ago
parent
commit
fd418b4f0e

+ 6 - 1
Bellwether/Pages/ucFrontPage.xaml.cs

@@ -57,7 +57,12 @@ namespace Bellwether.Pages
 
         private void UpdateSolarInfo()
         {
-            var client = new RestSharp.RestClient("https://dsegomspoctestenv.azurewebsites.net/api/siteoverview?act=9237&token=BWsolarenergy");
+            var url = Utility.Setting.SolarEnergyUrl;
+            if (string.IsNullOrEmpty(url))
+            {
+                url = "https://dsegomspoctestenv.azurewebsites.net/api/siteoverview?act=9237&token=BWsolarenergy";
+            }
+            var client = new RestSharp.RestClient(url);
             var request = new RestSharp.RestRequest(RestSharp.Method.GET);
             //request.AddParameter("act", "9237");
             //request.AddParameter("token", "BWsolarenergy");

+ 2 - 0
Bellwether/Utility/Setting.cs

@@ -13,6 +13,7 @@ namespace Bellwether.Utility
         public static readonly List<string> PageNameList = new List<string>() { "大事記", "產品展示", "社會責任" };
 
         public static int BackHomeSec { get => settingJsonFile.BackHomeSec; }
+        public static string SolarEnergyUrl { get => settingJsonFile.SolarEnergyUrl; }
 
         private static string dataDirectory = System.IO.Path.Combine(Directory.GetCurrentDirectory(), "Data");
         private static string settingJsonDataPath = System.IO.Path.Combine(dataDirectory, "setting.ini");
@@ -71,5 +72,6 @@ namespace Bellwether.Utility
     public class SettingJson
     {
         public int BackHomeSec { get; set; }
+        public string SolarEnergyUrl { get; set; }
     }
 }

+ 1 - 0
BellwetherBackend/Utility/Setting.cs

@@ -90,5 +90,6 @@ namespace BellwetherBackend.Utility
     public class SettingJson
     {
         public int BackHomeSec { get; set; }
+        public string SolarEnergyUrl { get; set; }
     }
 }