Click here to Skip to main content
12,510,006 members (53,232 online)
Click here to Skip to main content

Stats

43.6K views
805 downloads
17 bookmarked
Posted

(Hybrid Smart Client) RSS Media Player

, 9 Mar 2009 CPOL
A WPF application for viewing RSS video feeds. Built using the MVVM pattern.
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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Paul_Wade
Software Developer (Senior) Anytime Fitness
United States United States
No Biography provided

You may also be interested in...

Pro
Pro
| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.160929.1 | Last Updated 9 Mar 2009
Article Copyright 2009 by Paul_Wade
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid