예제 #1
0
        //Används för test

        /*public async void fetchPodcasts()
         * {
         *  PodcastReader pr = new PodcastReader();
         *  //Podcast joerog = await pr.ReadPodcastRSS("http://joeroganexp.joerogan.libsynpro.com/rss");
         *  Podcast ajt = await pr.ReadPodcastRSS("http://feeds.soundcloud.com/users/soundcloud:users:118147039/sounds.rss?fbclid=IwAR0UHQZF3GhpNmuazs4-Kw7K6--IzB0AZjQQ-4QqKOmCKqQqeGi6xdMweQo");
         *  //joerog.UpdateInterval = 5;
         *  ajt.UpdateInterval = 2;
         *  PodcastCollection podColl = new PodcastCollection();
         *  //podColl.Add(joerog);
         *  podColl.Add(ajt);
         *  Debug.WriteLine(podColl[0].UpdateInterval);
         *  podColl.Serialize();
         * }*/

        public async void AddPodcast(string link, string category, int update)
        {
            PodcastReader pr     = new PodcastReader();
            Podcast       newPod = await pr.ReadPodcastRSS(link);

            newPod.UpdateInterval = update;
            newPod.Category       = category;
            PodcastCollection podColl = new PodcastCollection();

            podColl = podColl.Deserialize();
            podColl.Add(newPod);
            podColl.Serialize();
        }
예제 #2
0
        public PodcastCollection GetPodcasts(string category)
        {
            PodcastCollection podColl = new PodcastCollection();

            podColl = podColl.Deserialize();

            List <Podcast> podcasts = (from pods in podColl
                                       where pods.Category.Equals(category)
                                       select pods).ToList();

            PodcastCollection podCollCategory = new PodcastCollection();

            foreach (Podcast pod in podcasts)
            {
                podCollCategory.Add(pod);
            }

            return(podCollCategory);
        }