Parcourir la source

修正eventbar參數

kangkangtm il y a 1 an
Parent
commit
8b056a74ad

+ 3 - 1
CMSCollection/CMSCollection.cs

@@ -194,7 +194,7 @@ namespace KdanCommon.CMSCollection
             }
         }
 
-        public async Task<List<WindowsEnentbarSetting>> GetWindowsEventbarAsync()
+        public async Task<List<WindowsEventbarSetting>> GetWindowsEventbarAsync()
         {
             var current = DateTime.UtcNow.ToString("s", CultureInfo.GetCultureInfo("en-us"));
             string region = GetSystemRegion();
@@ -221,6 +221,8 @@ namespace KdanCommon.CMSCollection
                 {
                     return response.Data.ToList();
                 }
+                else
+                    return new List<WindowsEventbarSetting>();
             }
             return null;
         }

+ 9 - 4
CMSCollection/Data/WindowsEventbarResponse.cs

@@ -14,13 +14,13 @@ namespace KdanCommon.CMSCollection.Data
     public partial class WindowsEventbarResponse
     {
         [JsonProperty("data")]
-        public WindowsEnentbarSetting[] Data { get; set; }
+        public WindowsEventbarSetting[] Data { get; set; }
     }
 
-    public partial class WindowsEnentbarSetting : ISetting
+    public partial class WindowsEventbarSetting : ISetting
     {
         [JsonConstructor]
-        private WindowsEnentbarSetting(string id, string app_type, DateTime start, DateTime end, string event_icon, string close_icon, string text_color, string background_color, EventbarInformation[] event_information)
+        private WindowsEventbarSetting(string id, string app_type, DateTime start, DateTime end, string event_icon, string close_icon, string text_color, string background_color, EventbarInformation[] event_information, bool is_close_button_show)
         {
             if (close_icon != null)
                 CloseIcon = new Uri($"{CMSCollection.CMSDomain}/assets/{close_icon}");
@@ -33,10 +33,11 @@ namespace KdanCommon.CMSCollection.Data
             Id = id;
             Start = start;
             End = end;
-            if(event_information!=null)
+            if (event_information != null)
             {
                 EventbarInformation = event_information.FirstOrDefault();
             }
+            IsCloseButtonShow = is_close_button_show;
         }
         public string SettingName
         {
@@ -72,6 +73,10 @@ namespace KdanCommon.CMSCollection.Data
         {
             get;
         }
+        public bool IsCloseButtonShow
+        {
+            get;
+        }
     }
 
     public partial class EventbarInformation