public async Task DownloadNews() { //Task downloadTask = MainNewsViewModel.DownloadNews(); //await downloadTask.ContinueWith(OnDownloadCompleted); if (!IsInternet()) { VisibilityLoading = Visibility.Visible; VisibilityProgressRing = Visibility.Collapsed; LoadingTextBlockText = "No internet connection :("; return; } Task downloadNewsTask = _news.DownloadNews(); await downloadNewsTask.ContinueWith(OnDownloadCompleted); //add to articles foreach (var article in _news.Articles) { ArticleViewModel newArticleViewModel = new ArticleViewModel( article.Date, article.Link, article.Title ); _articles.Add(newArticleViewModel); } VisibilityProgressRing = Visibility.Collapsed; }
protected override async void OnNavigatedTo(NavigationEventArgs e) { RotationStoryboard.Begin(); _article = e.Parameter as ArticleViewModel; await DownloadArticle(); //fillContent(content); base.OnNavigatedTo(e); }
public void ConstructorTest() { //arrange //act string date = "28.08.15"; string link = "link"; string title = "title"; ArticleViewModel articleViewModel = new ArticleViewModel(date, link, title); Assert.AreEqual(date, articleViewModel.Date); Assert.AreEqual(link, articleViewModel.Link); Assert.AreEqual(title, articleViewModel.Title); }
private async Task FillRTB(ArticleViewModel article) { var blocks = await ArticleContentDownloader.GetRichTextBoxContentByLink(article.Link); RichContent.Blocks.Clear(); foreach (Block b in blocks) RichContent.Blocks.Add(b); TextBlockLoading.Visibility = Visibility.Collapsed; RotationStoryboard.Stop(); }