// Called during a remove operation private void DetachArticle(Article article) { NotifyPropertyChanging("Article"); article.Channel = null; if (!article.IsRead) NewCount--; }
public void RemoveStar(Article art) { art.IsStared = false; StaredArticles.Remove(art); }
// Called during an add operation private void AttachArticle(Article article) { NotifyPropertyChanging("Article"); article.Channel = this; NewCount++; }
// Remove a to-do task item from the database and collections. public void DeleteArticle(Article article, Channel channel) { // Remove the to-do item from the "all" observable collection. AllArticles.Remove(article); NewArticles.Remove(article); channel.Articles.Remove(article); // Remove the to-do item from the data context. _rssDb.Articles.DeleteOnSubmit(article); }
// Remove a to-do task item from the database and collections. public void DeleteArticle(Article[] articles, Channel channel) { foreach (Article art in articles) { DeleteArticle(art, channel); } }
public void AddStar(Article art) { art.IsStared = true; StaredArticles.Insert(0, art); }
// Add a to-do item to the database and collections. public Article AddArticle(Article article, Channel channel) { Article art = channel.Articles.FirstOrDefault(x => x.Link == article.Link); if (art == null) { channel.Articles.Add(article); // Add a to-do item to the data context. _rssDb.Articles.InsertOnSubmit(article); return article; } return art; }
private object AddArticleToView(Article art, PivotItem item) { art.IsRead = true; var scroll = new ScrollViewer(); var panel = new StackPanel(); scroll.Content = panel; panel.Children.Add(new HTMLTextBox() { Html = String.Format("<a style='color:{2}' href='{0}'>{1}</a>", art.Link, art.Title,App.ViewModel.Foreground), Margin = _titleMargin, FontSize = 28 }); panel.Children.Add(new Border { Background = (Brush)App.Current.Resources["PhoneAccentBrush"], Child = new TextBlock { HorizontalAlignment = HorizontalAlignment.Right, Text = RssViewModel.DateConvertor.ToUserFriendlyString(art.PubDate).ToString(), FontSize = 20, Margin = _padding, Foreground = App.WhiteColor }, Margin = _padding }); panel.Children.Add(new HTMLTextBox { Html = "<style type='text/css'>a{color:gray;}</style>" + art.Description, Padding = _bodyMargin, FontSize = 24 }); item.Content = scroll; item.Tag = art; return panel; }