RSSFeed.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*
  2. * Copyright © 2011-2012 Nokia Corporation. All rights reserved.
  3. * Nokia and Nokia Connecting People are registered trademarks of Nokia Corporation.
  4. * Other product and company names mentioned herein may be trademarks
  5. * or trade names of their respective owners.
  6. * See LICENSE.TXT for license information.
  7. */
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Runtime.Serialization;
  11. using System.ComponentModel;
  12. namespace RSSReader.Model
  13. {
  14. /// <summary>
  15. /// A single RSS feed
  16. /// </summary>
  17. [DataContract(IsReference = true)]
  18. public class RSSFeed : INotifyPropertyChanged
  19. {
  20. /// <summary>
  21. /// Implementation of PropertyChanged event declared in INotifyPropertyChanged
  22. /// </summary>
  23. public event PropertyChangedEventHandler PropertyChanged;
  24. /// <summary>
  25. /// Property for URL of the feed
  26. /// </summary>
  27. [DataMember]
  28. public String URL { get; set; }
  29. /// <summary>
  30. /// Class member for image URL of the feed
  31. /// </summary>
  32. private String imageURL;
  33. /// <summary>
  34. /// Property for image URL of the feed
  35. /// </summary>
  36. [DataMember]
  37. public String ImageURL
  38. {
  39. get
  40. {
  41. return imageURL;
  42. }
  43. set
  44. {
  45. if (imageURL != value)
  46. {
  47. imageURL = value;
  48. OnPropertyChanged("ImageURL");
  49. }
  50. }
  51. }
  52. /// <summary>
  53. /// The title of the feed
  54. /// </summary>
  55. [DataMember]
  56. public String Title { get; set; }
  57. /// <summary>
  58. /// A list of items for this feed
  59. /// </summary>
  60. [DataMember]
  61. public List<RSSItem> Items { get; set; }
  62. /// <summary>
  63. /// The timestamp this feed was last refreshed
  64. /// Used when checking if cache can be used or
  65. /// should the feed be refreshed
  66. /// </summary>
  67. [DataMember]
  68. public DateTime Timestamp { get; set; }
  69. /// <summary>
  70. /// Whether the feed is visible on the RSSPage or not
  71. /// </summary>
  72. [DataMember]
  73. public Boolean IsVisible { get; set; }
  74. /// <summary>
  75. /// Default constructor
  76. /// </summary>
  77. public RSSFeed()
  78. {
  79. }
  80. /// <summary>
  81. /// Constructor
  82. /// </summary>
  83. /// <param name="url">URL of the feed</param>
  84. /// <param name="title">Title of the feed</param>
  85. public RSSFeed(String url, String title)
  86. {
  87. this.URL = url;
  88. this.Title = title;
  89. this.Items = new List<RSSItem>();
  90. }
  91. /// <summary>
  92. /// Helper method for PropertyChanged event
  93. /// </summary>
  94. /// <param name="changed">Name of the property that has changed</param>
  95. protected virtual void OnPropertyChanged(String changed)
  96. {
  97. if (PropertyChanged != null)
  98. {
  99. PropertyChanged(this, new PropertyChangedEventArgs(changed));
  100. }
  101. }
  102. }
  103. }