RSSPage.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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.Windows.Data;
  12. namespace RSSReader.Model
  13. {
  14. /// <summary>
  15. /// A page of RSS feeds
  16. /// </summary>
  17. [DataContract(IsReference = true)]
  18. public class RSSPage
  19. {
  20. /// <summary>
  21. /// The title of the page
  22. /// </summary>
  23. [DataMember]
  24. public String Title { get; set; }
  25. /// <summary>
  26. /// Class member for feeds of the page
  27. /// </summary>
  28. private List<RSSFeed> feeds;
  29. /// <summary>
  30. /// Property for feeds of the page
  31. /// </summary>
  32. [DataMember]
  33. public List<RSSFeed> Feeds
  34. {
  35. get
  36. {
  37. if (feeds == null)
  38. {
  39. feeds = new List<RSSFeed>();
  40. }
  41. return feeds;
  42. }
  43. set
  44. {
  45. if (feeds != value)
  46. {
  47. feeds = value;
  48. }
  49. }
  50. }
  51. /// <summary>
  52. /// Class member feeds of the page as CollectionViewSource
  53. /// </summary>
  54. private CollectionViewSource feedsView;
  55. /// <summary>
  56. /// Property for feeds of the page as CollectionViewSource
  57. /// </summary>
  58. public CollectionViewSource FeedsView
  59. {
  60. get
  61. {
  62. if (feedsView == null)
  63. {
  64. feedsView = new CollectionViewSource();
  65. feedsView.Source = Feeds;
  66. feedsView.View.Filter = f =>
  67. {
  68. if (f == null) return true;
  69. RSSFeed feed = (RSSFeed)f;
  70. return feed.IsVisible;
  71. };
  72. }
  73. return feedsView;
  74. }
  75. set
  76. {
  77. if (feedsView != value)
  78. {
  79. feedsView = value;
  80. }
  81. }
  82. }
  83. }
  84. }