private void RemoveFeed(object obj) { var f = SelectedFeed as FeedViewModel; FeedsList.Remove(f); _model.RemoveFeed(f.GetModel()); }
public ManageRssFeedsViewModel() { EditedRssFeed.Url = "http://developmentsimplyput.blogspot.com/feeds/posts/default?alt=rss"; EditedRssFeed.Title = "Test"; FeedsList.Add(new RssFeedViewModel("Sample 1", "http://developmentsimplyput.blogspot.com/feeds/posts/default?alt=rss")); FeedsList.Add(new RssFeedViewModel("Sample 2", "http://www.feedforall.com/sample.xml")); FeedsList.Add(new RssFeedViewModel("Sample 3", "http://www.feedforall.com/sample-feed.xml")); FeedsList.Add(new RssFeedViewModel("Sample 4", "http://www.feedforall.com/blog-feed.xml")); FeedsList.Add(new RssFeedViewModel("Sample 5", "http://www.rss-specifications.com/blog-feed.xml")); FeedsList.Add(new RssFeedViewModel("Sample 6", "http://news.google.us/nwshp?hl=en&tab=wn&output=rss")); FeedsList.Add(new RssFeedViewModel("Sample 7", "http://feeds.abcnews.com/abcnews/topstories")); FeedsList.Add(new RssFeedViewModel("Sample 8", "http://feeds.abcnews.com/abcnews/internationalheadlines")); FeedsList.Add(new RssFeedViewModel("Sample 9", "http://feeds.abcnews.com/abcnews/usheadlines")); FeedsList.Add(new RssFeedViewModel("Sample 10", "http://feeds.abcnews.com/abcnews/politicsheadlines")); FeedsList.Add(new RssFeedViewModel("Sample 11", "http://feeds.abcnews.com/abcnews/blotterheadlines")); FeedsList.Add(new RssFeedViewModel("Sample 12", "http://feeds.abcnews.com/abcnews/thelawheadlines")); FeedsList.Add(new RssFeedViewModel("Sample 13", "http://feeds.abcnews.com/abcnews/moneyheadlines")); FeedsList.Add(new RssFeedViewModel("Sample 14", "http://feeds.abcnews.com/abcnews/technologyheadlines")); FeedsList.Add(new RssFeedViewModel("Sample 15", "http://feeds.abcnews.com/abcnews/healthheadlines")); FeedsList.Add(new RssFeedViewModel("Sample 16", "http://feeds.abcnews.com/abcnews/entertainmentheadlines")); FeedsList.Add(new RssFeedViewModel("Sample 17", "http://feeds.abcnews.com/abcnews/travelheadlines")); FeedsList.Add(new RssFeedViewModel("Sample 18", "http://feeds.abcnews.com/abcnews/sportsheadlines")); FeedsList.Add(new RssFeedViewModel("Sample 19", "http://feeds.abcnews.com/abcnews/worldnewsheadlines")); FeedsList.Add(new RssFeedViewModel("Sample 20", "http://feeds.abcnews.com/abcnews/2020headlines")); FeedsList.Add(new RssFeedViewModel("Sample 21", "http://feeds.abcnews.com/abcnews/primetimeheadlines")); FeedsList.Add(new RssFeedViewModel("Sample 22", "http://feeds.abcnews.com/abcnews/nightlineheadlines")); FeedsList.Add(new RssFeedViewModel("Sample 23", "http://feeds.abcnews.com/abcnews/gmaheadlines")); FeedsList.Add(new RssFeedViewModel("Sample 24", "http://feeds.abcnews.com/abcnews/thisweekheadlines")); FeedsList.Add(new RssFeedViewModel("Sample 25", "http://abcnews.go.com/Site/page/rss--3520115#top")); FeedsList.Add(new RssFeedViewModel("Sample 26", "http://feeds.abcnews.com/abcnews/mostreadstories")); }
public void DeleteRssFeed(RssFeedViewModel rssFeed) { if (rssFeed != null) { FeedsList.Remove(rssFeed); } }
public void DeleteRssFeed(Guid rssFeedId) { RssFeedViewModel found = FeedsList.DefaultIfEmpty(null).FirstOrDefault(feed => feed.Id == rssFeedId); if (found != null) { DeleteRssFeed(found); } }
public RssFeedViewModel AddRssFeed(RssFeedViewModel rssFeed) { if (rssFeed != null) { FeedsList.Add(rssFeed); } return(rssFeed); }
public Feeds(bool beSeen, string name, string feedUrl, string imagePath) { ToBeSeen = beSeen; Name = name; FeedUrl = feedUrl; ImagePath = imagePath; FeedsList.Add(this); }
private async Task SaveFavoritesData() { RssFeedModel favorites = FeedsList.Where(f => f.Link.Equals(new Uri("http://localhost"))).FirstOrDefault(); byte[] array = serialize(favorites, typeof(RssFeedModel)); var file = await storageFolder.CreateFileAsync("favorites.dat", CreationCollisionOption.ReplaceExisting); await FileIO.WriteBytesAsync(file, array); }
private void AddFeed(object obj) { var f = new FeedViewModel(new FeedModel("about:blank")); var dialog = new AddFeedDialog(f); bool?res = dialog.ShowDialog(); if (!((res == null) || !res.Value)) { if (!string.IsNullOrEmpty(f.Link)) { FeedsList.Add(f); _model.AddFeed(f.GetModel()); } } }
private async Task AddRssFeed(string url) { try { SyndicationClient client = new SyndicationClient(); Uri myUri; if (Uri.TryCreate(url, UriKind.Absolute, out myUri)) { if ((myUri.Scheme == "http" || myUri.Scheme == "https")) { SyndicationFeed feed = await client.RetrieveFeedAsync(new Uri(url)); RssFeedModel feedModel = new RssFeedModel(feed.Title.Text, feed.Subtitle != null ? feed.Subtitle.Text : "", new Uri(url), null); feedModel.ArticleList = new ObservableCollection <RssArticleModel>(feed.Items.Select(f => new RssArticleModel(f.Title.Text, f.Summary != null ? Regex.Replace(Regex.Replace(f.Summary.Text, "\\&.{0,4}\\;", string.Empty), "<.*?>", string.Empty) : "", f.Authors.Select(a => a.NodeValue).FirstOrDefault(), f.ItemUri != null ? f.ItemUri : f.Links.Select(l => l.Uri).FirstOrDefault() ))); if (FeedsList.Contains(feedModel)) { FeedsList.Remove(feedModel); } FeedsList.Add(feedModel); } } } catch (Exception) { InvalidRSSFeedMessageVisibility = Visibility.Visible; } }
public void RemoveFeed(FeedModel feed) { FeedsList.Remove(feed); }
public void AddFeed(FeedModel feed) { FeedsList.Add(feed); }
public FeedsArticlesViewModel() { storageFolder = ApplicationData.Current.LocalFolder; AddFeedCommand = new DelegateCommand(async() => { await AddRssFeed(RssFeedToLoad); await SaveFeedsData(); }); this.DeleteFeedCommand = new DelegateCommand <RssFeedModel>(async feed => { if (feed != null) { FeedsList.Remove(feed); await SaveFeedsData(); } }); this.AddFavoriteCommand = new DelegateCommand <RssArticleModel>(async article => { if (article != null) { FavoritesFeed.ArticleList.Add(article); if (!this.favoriteArticlesHash.Contains(article)) { this.favoriteArticlesHash.Add(article); } article.IsFavoritable = Visibility.Collapsed; article.IsDeletable = Visibility.Visible; await SaveFavoritesData(); } }); this.DeleteFavoriteCommand = new DelegateCommand <RssArticleModel>(async article => { if (article != null) { if (this.favoriteArticlesHash.Contains(article)) { this.favoriteArticlesHash.Remove(article); } article.IsDeletable = Visibility.Collapsed; article.IsFavoritable = Visibility.Visible; FavoritesFeed.ArticleList.Remove(article); await SaveFavoritesData(); } }); this.OpenUrlCommand = new DelegateCommand <RssArticleModel>(async article => { if (article != null) { await Windows.System.Launcher.LaunchUriAsync(article.Link); } }); this.feedsList = new ObservableCollection <RssFeedModel>(); this.favoriteArticlesHash = new HashSet <RssArticleModel>(); }