WindowsEventbarResponse.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. using KdanCommon.Helpers;
  2. using Newtonsoft.Json;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using Windows.System;
  9. using Windows.UI;
  10. using Windows.UI.Xaml.Media.Animation;
  11. namespace KdanCommon.CMSCollection.Data
  12. {
  13. public partial class WindowsEventbarResponse
  14. {
  15. [JsonProperty("data")]
  16. public WindowsEnentbarSetting[] Data { get; set; }
  17. }
  18. public partial class WindowsEnentbarSetting : ISetting
  19. {
  20. [JsonConstructor]
  21. 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)
  22. {
  23. if (close_icon != null)
  24. CloseIcon = new Uri($"{CMSCollection.CMSDomain}/assets/{close_icon}");
  25. if (event_icon != null)
  26. EventIcon = new Uri($"{CMSCollection.CMSDomain}/assets/{event_icon}");
  27. if (text_color != null)
  28. TextColor = text_color.ToColor();
  29. if (background_color != null)
  30. BackgroundColor = background_color.ToColor();
  31. Id = id;
  32. Start = start;
  33. End = end;
  34. if(event_information!=null)
  35. {
  36. EventbarInformation = event_information.FirstOrDefault();
  37. }
  38. }
  39. public string SettingName
  40. {
  41. get
  42. {
  43. return Id;
  44. }
  45. }
  46. public string Id { get; }
  47. public DateTime Start { get; }
  48. public DateTime End { get; }
  49. public Color TextColor
  50. {
  51. get;
  52. }
  53. public Color BackgroundColor
  54. {
  55. get;
  56. }
  57. public EventbarInformation EventbarInformation { get; }
  58. public Uri EventIcon
  59. {
  60. get;
  61. }
  62. public Uri CloseIcon
  63. {
  64. get;
  65. }
  66. }
  67. public partial class EventbarInformation
  68. {
  69. [JsonProperty("event_title")]
  70. public string EventTitle { get; set; }
  71. [JsonProperty("event_link")]
  72. public string EventLink { get; set; }
  73. }
  74. }