public void AddChild(News news) { if (data == null) { data = news; } else { if (DateTimeOffset.Compare(data.date, news.date) < 0) { SinglyLinkedNode newChild = new SinglyLinkedNode(data, child); child = newChild; data = news; } else { if (child != null) { child.AddChild(news); } else { child = new SinglyLinkedNode(news); } } } }
private void GetRSSFeed() { SinglyLinkedNode list = new SinglyLinkedNode(); for (int i = 0; i < url.Length; i++) { string[] source = url[i].Split(' '); XmlReader reader = XmlReader.Create(source[0]); SyndicationFeed feed = SyndicationFeed.Load(reader); reader.Close(); foreach (SyndicationItem item in feed.Items) { if (item.Title.Text.Length != 1) { BitmapImage image = null; try { image = new BitmapImage(new Uri(item.Links[1].Uri.ToString())); } catch (Exception ex) { } list.AddChild(new News(image, item.Title.Text, item.PublishDate, item.Links[0].Uri.ToString(), source[1])); } } } list.createList(newsList); }