Beispiel #1
0
        private async Task UpdateSportsNews()
        {
            NewsRetriever    newsRetriever = new NewsRetriever();
            SportsRootObject sportsRoot    = await newsRetriever.GetSportsArticles();

            SportsDayViewModel first = new SportsDayViewModel();

            first.author      = sportsRoot.articles.ElementAt(0).author;
            first.title       = sportsRoot.articles.ElementAt(0).title;
            first.description = sportsRoot.articles.ElementAt(0).description;
            first.url         = sportsRoot.articles.ElementAt(0).url;
            first.urlToImage  = sportsRoot.articles.ElementAt(0).urlToImage;
            news.Add(first);

            SportsDayViewModel second = new SportsDayViewModel();

            second.author      = sportsRoot.articles.ElementAt(1).author;
            second.title       = sportsRoot.articles.ElementAt(1).title;
            second.description = sportsRoot.articles.ElementAt(1).description;
            second.url         = sportsRoot.articles.ElementAt(1).url;
            second.urlToImage  = sportsRoot.articles.ElementAt(1).urlToImage;
            news.Add(second);

            SportsDayViewModel third = new SportsDayViewModel();

            third.author      = sportsRoot.articles.ElementAt(2).author;
            third.title       = sportsRoot.articles.ElementAt(2).title;
            third.description = sportsRoot.articles.ElementAt(2).description;
            third.url         = sportsRoot.articles.ElementAt(2).url;
            third.urlToImage  = sportsRoot.articles.ElementAt(2).urlToImage;
            news.Add(third);
            SportsDayViewModel fourth = new SportsDayViewModel();

            fourth.author      = sportsRoot.articles.ElementAt(3).author;
            fourth.title       = sportsRoot.articles.ElementAt(3).title;
            fourth.description = sportsRoot.articles.ElementAt(3).description;
            fourth.url         = sportsRoot.articles.ElementAt(3).url;
            fourth.urlToImage  = sportsRoot.articles.ElementAt(3).urlToImage;
            news.Add(fourth);
        }
Beispiel #2
0
        private async Task MoreNews()
        {
            NewsRetriever        newsRetriever  = new NewsRetriever();
            ConditionsRootObject conditionsRoot = await newsRetriever.GetConditions();

            NewsDayViewModel first = new NewsDayViewModel();

            first.author      = conditionsRoot.articles.ElementAt(4).author;
            first.title       = conditionsRoot.articles.ElementAt(4).title;
            first.description = conditionsRoot.articles.ElementAt(4).description;
            first.url         = conditionsRoot.articles.ElementAt(4).url;
            first.urlToImage  = conditionsRoot.articles.ElementAt(4).urlToImage;
            news.Add(first);

            NewsDayViewModel second = new NewsDayViewModel();

            second.author      = conditionsRoot.articles.ElementAt(5).author;
            second.title       = conditionsRoot.articles.ElementAt(5).title;
            second.description = conditionsRoot.articles.ElementAt(5).description;
            second.url         = conditionsRoot.articles.ElementAt(5).url;
            second.urlToImage  = conditionsRoot.articles.ElementAt(5).urlToImage;
            news.Add(second);

            NewsDayViewModel third = new NewsDayViewModel();

            third.author      = conditionsRoot.articles.ElementAt(6).author;
            third.title       = conditionsRoot.articles.ElementAt(6).title;
            third.description = conditionsRoot.articles.ElementAt(6).description;
            third.url         = conditionsRoot.articles.ElementAt(6).url;
            third.urlToImage  = conditionsRoot.articles.ElementAt(6).urlToImage;
            news.Add(third);
            NewsDayViewModel fourth = new NewsDayViewModel();

            fourth.author      = conditionsRoot.articles.ElementAt(7).author;
            fourth.title       = conditionsRoot.articles.ElementAt(7).title;
            fourth.description = conditionsRoot.articles.ElementAt(7).description;
            fourth.url         = conditionsRoot.articles.ElementAt(7).url;
            fourth.urlToImage  = conditionsRoot.articles.ElementAt(7).urlToImage;
            news.Add(fourth);
        }
Beispiel #3
0
        private async Task MoreTechNews()
        {
            NewsRetriever  newsRetriever = new NewsRetriever();
            TechRootObject techRoot      = await newsRetriever.GetTechArticles();

            TechViewDayModel first = new TechViewDayModel();

            first.author      = techRoot.articles.ElementAt(4).author;
            first.title       = techRoot.articles.ElementAt(4).title;
            first.description = techRoot.articles.ElementAt(4).description;
            first.url         = techRoot.articles.ElementAt(4).url;
            first.urlToImage  = techRoot.articles.ElementAt(4).urlToImage;
            news.Add(first);

            TechViewDayModel second = new TechViewDayModel();

            second.author      = techRoot.articles.ElementAt(5).author;
            second.title       = techRoot.articles.ElementAt(5).title;
            second.description = techRoot.articles.ElementAt(5).description;
            second.url         = techRoot.articles.ElementAt(5).url;
            second.urlToImage  = techRoot.articles.ElementAt(5).urlToImage;
            news.Add(second);

            TechViewDayModel third = new TechViewDayModel();

            third.author      = techRoot.articles.ElementAt(6).author;
            third.title       = techRoot.articles.ElementAt(6).title;
            third.description = techRoot.articles.ElementAt(6).description;
            third.url         = techRoot.articles.ElementAt(6).url;
            third.urlToImage  = techRoot.articles.ElementAt(6).urlToImage;
            news.Add(third);
            TechViewDayModel fourth = new TechViewDayModel();

            fourth.author      = techRoot.articles.ElementAt(7).author;
            fourth.title       = techRoot.articles.ElementAt(7).title;
            fourth.description = techRoot.articles.ElementAt(7).description;
            fourth.url         = techRoot.articles.ElementAt(7).url;
            fourth.urlToImage  = techRoot.articles.ElementAt(7).urlToImage;
            news.Add(fourth);
        }