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