protected void LoadNewsfeeds() //TODO Add Page parameter to make it more universal
 {
     new Thread(async() =>
     {
         IsLoading = true;
         Newsfeeds = new ObservableCollection <Newsfeed>(await _newsfeedService.LoadNewsfeedsAsync(_page));
         IsLoading = false;
     }).Start();
 }
Ejemplo n.º 2
0
        private async Task CheckNewPosts(NewsCategory page)
        {
            List <Newsfeed> list          = new List <Newsfeed>(await _newsfeedService.LoadNewsfeedsAsync(page));
            List <Newsfeed> newPosts      = new List <Newsfeed>();
            string          lastPostTitle = _settingsService[page].LastPostTitle;

            if (lastPostTitle != null)
            {
                foreach (Newsfeed newsfeed in list)
                {
                    if (newsfeed.Title == lastPostTitle)
                    {
                        break;
                    }
                    else
                    {
                        newPosts.Add(newsfeed);
                    }
                }
            }

            _settingsService.SaveLastPostTitle(page, list[0].Title);

            if (newPosts.Count > 0)
            {
                _notificationService.ShowNewPostNotification(newPosts[0], page); //TODO Show all new post not only one
            }
        }