示例#1
0
        public async Task PeriodicUpdateFeed(PodcastCollection podcastColl, Podcast podcast, CancellationToken canceltoken)
        {
            TimeSpan      ts       = new TimeSpan(0, podcast.UpdateInterval, 0);
            PodcastReader pr       = new PodcastReader();
            int           oldIndex = 0;

            //Remember where in the list the podcast is.
            for (int i = 0; i < podcastColl.Count; i++)
            {
                if (podcastColl[i].Equals(podcast))
                {
                    oldIndex = i;
                }
            }
            Podcast oldPod = podcastColl[oldIndex];

            //Async delen
            while (true)
            {
                Debug.WriteLine(podcast.Link);
                Podcast newPod = await pr.ReadPodcastRSS(podcast.Link);

                //If the podcast isn't the same, change it.
                if (!newPod.Equals(oldPod))
                {
                    int updateInterval = oldPod.UpdateInterval;
                    podcastColl[oldIndex] = newPod;
                    podcastColl[oldIndex].UpdateInterval = updateInterval;
                    //INSERT UPDATEINTERVAL INTO podcastColl[oldIndex] HERE FROM FORM
                    podcastColl.Serialize();
                }

                await Task.Delay(ts, canceltoken);
            }
        }
示例#2
0
        public void Equals_Returns_False_When_Null()
        {
            var result = subject.Equals(null);

            Assert.That(result, Is.False);
        }
示例#3
0
 public bool Equals(PodcastViewModel other)
 {
     return(Podcast.Equals(other.Podcast));
 }