//----------------------------------------------------------------------------- // // Company copyright tag. // // fiedlchr // 24.06.2013 //----------------------------------------------------------------------------- namespace CampusAppWP8ScheduledTaskAgent.Model.RSS { using System.Collections.ObjectModel; using System.Collections.Specialized; using System.Xml.Serialization; /// /// Channel Model, which contains the RSS feed item list. /// public class RSSChannelModel { /// /// RSS feed information item list. /// private ObservableCollection item; #region Constructor /// /// Initializes a new instance of the class. /// public RSSChannelModel() { this.item = new ObservableCollection(); this.item.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged); } #endregion #region Property /// /// Gets or sets the RSS feed item list. /// [XmlElement("item")] public ObservableCollection Item { get { return this.item; } set { if (value != this.item) { this.item = value; } } } #endregion #region Method /// /// Is called when the item list has changed. /// Here used for the add event. /// Set the index of the last list element. /// /// item list /// event args private void OnListChanged(object sender, NotifyCollectionChangedEventArgs e) { if (e.Action == NotifyCollectionChangedAction.Add) { ObservableCollection list = sender as ObservableCollection; list[list.Count - 1].Index = list.Count - 1; } } #endregion } }