WindowsEventbarResponse.cs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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 WindowsEventbarSetting[] Data { get; set; }
  17. }
  18. public partial class WindowsEventbarSetting : ISetting
  19. {
  20. [JsonConstructor]
  21. 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)
  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. IsCloseButtonShow = is_close_button_show;
  39. }
  40. public string SettingName
  41. {
  42. get
  43. {
  44. return Id;
  45. }
  46. }
  47. public string Id { get; }
  48. public DateTime Start { get; }
  49. public DateTime End { get; }
  50. public Color TextColor
  51. {
  52. get;
  53. }
  54. public Color BackgroundColor
  55. {
  56. get;
  57. }
  58. public EventbarInformation EventbarInformation { get; }
  59. public Uri EventIcon
  60. {
  61. get;
  62. }
  63. public Uri CloseIcon
  64. {
  65. get;
  66. }
  67. public bool IsCloseButtonShow
  68. {
  69. get;
  70. }
  71. }
  72. public partial class EventbarInformation
  73. {
  74. [JsonProperty("event_title")]
  75. public string EventTitle { get; set; }
  76. [JsonProperty("event_link")]
  77. public string EventLink { get; set; }
  78. }
  79. }