|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using RSSVideoPlayer.Data;
using RSSVideoPlayer.Model;
using System.Windows.Controls;
namespace RSSVideoPlayer.ViewModel
{
class RSSViewModel : TabViewModel
{
private List<FeedItem> _Articals;
public RSSViewModel()
{
base.TabName = "RSS Items";
_Articals = new RSSRepository("http://windowsclient.net/blogs/MainFeed.aspx?GroupID=11&Type=AllBlogs").GetFeedItems;
}
#region "Properties"
private string _RSSURL;
public string RSSURL
{
get { return _RSSURL; }
set {
_RSSURL = value;
_Articals = new RSSRepository(_RSSURL).GetFeedItems;
OnPropertyChanged("Articals");
OnPropertyChanged("RSSURL");
}
}
public List<FeedItem> Articals
{
get { return _Articals; }
}
public List<MediaItem> MediaItems
{
get { return SelectedArtical.MediaItems; }
}
private FeedItem _SelectedArtical;
public FeedItem SelectedArtical
{
get { return _SelectedArtical; }
set
{
_SelectedArtical = value;
OnPropertyChanged("SelectedArtical");
OnPropertyChanged("SelectedMedia");
OnPropertyChanged("MediaItems");
}
}
private MediaItem _SelectedMedia;
public MediaItem SelectedMedia
{
get { return _SelectedMedia; }
set
{
_SelectedMedia = value;
OnPropertyChanged("SelectedMedia");
OnNewMedia(SelectedMedia.FullURL);
}
}
public List<ComboBoxItem> SavedURLS
{
get
{
List<ComboBoxItem> lst = new List<ComboBoxItem>();
foreach (string s in Properties.Settings.Default.RSSURLS)
{
ComboBoxItem cmb = new ComboBoxItem();
cmb.Content = s;
lst.Add(cmb);
}
return lst;
}
}
#endregion
public event EventHandler<Common.MediaChangedEventArgs> NewMediaItem;
private void OnNewMedia(string Media)
{
if (NewMediaItem != null)
NewMediaItem(this,new RSSVideoPlayer.Common.MediaChangedEventArgs(Media));
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.