private void ImportOpmlItem(OpmlItem item) { foreach (OpmlItem childItem in item.ChildItems) { ImportOpmlItem(childItem); } var newLink = new Link { Title = item.Title, Url = item.HtmlUrl, Rss = item.XmlUrl, CategoryId = _categoryID, IsActive = true, NewWindow = false }; // TODO: let user specify and pass as command props // this isn't a valid collision test really if (!_allLinks.Contains(newLink)) { Links.CreateLink(newLink); } }
private void ProcessOpmlElements(Opml opml, XmlNode bodyNode) { ArrayList items = new ArrayList(); foreach (XmlNode node in bodyNode.ChildNodes) { XmlElement element = node as XmlElement; // skip over non-elements (like comments) if (element == null) { continue; } if (element.LocalName == "outline") { OpmlItem item = new OpmlItem(); if (element.HasAttribute("title")) { item.Title = element.Attributes["title"].Value; } if (element.HasAttribute("text")) { item.Title = element.Attributes["text"].Value; } if (element.HasAttribute("htmlUrl")) { item.HtmlUrl = element.Attributes["htmlUrl"].Value; } if (element.HasAttribute("xmlUrl")) { item.XmlUrl = element.Attributes["xmlUrl"].Value; } if (element.HasAttribute("Type")) { item.Type = element.Attributes["type"].Value; } items.Add(item); //if (element.HasChildNodes) //{ // ProcessOpmlElements(opml, element); //} } } opml.Items = (OpmlItem[])items.ToArray(typeof(OpmlItem)); }
private void LoadOpml() { //Load opml int saveHeight = listFeeds.Height; //listFeeds.Height = saveHeight - 20; Cursor.Current = Cursors.WaitCursor; Opml opml = FeedEngine.LoadOpml(opmlPath); int count = opml.Items.Length; this.Invoke(startProgressHandler); // Populate TreeView for (int i = 0; i < count; i++) { //TreeNode node = new TreeNode(opmlItem.Title); //node.Tag = opmlItem.Title; OpmlItem opmlItem = (OpmlItem)opml.Items[i]; currentFeed = FeedEngine.Storage.GetFeed(opmlItem.Title); if (currentFeed == null) { currentFeed = FeedEngine.Receive(new Uri(opmlItem.XmlUrl)); FeedEngine.Storage.Add(currentFeed); } loadProgress = (int)((double)i / count * 100); this.Invoke(updateProgressHandler); this.Invoke(addNodeHandler); } FeedEngine.SubscribeOpml(opml); this.Invoke(endProgressHandler); //listFeeds.Height = saveHeight; Cursor.Current = Cursors.Default; //FeedEngine.Start(); }
private void LoadOpmlThread() { Cursor.Current = Cursors.WaitCursor; opml = FeedEngine.LoadOpml(opmlPath); int count = opml.Items.Length; mainForm.StartProgress(); // Populate TreeView for (int i = 0; i < count; i++) { //TreeNode node = new TreeNode(opmlItem.Title); //node.Tag = opmlItem.Title; OpmlItem opmlItem = (OpmlItem)opml.Items[i]; currentFeed = FeedEngine.Storage.GetFeed(opmlItem.Title); if (currentFeed == null) { currentFeed = FeedEngine.Receive(new Uri(opmlItem.XmlUrl)); updateCount = currentFeed.Items.Count; mainForm.UpdateTreeNode(); FeedEngine.Storage.Add(currentFeed); } this.loadProgress = (int)((double)i / count * 100); mainForm.UpdateProgress(); mainForm.AddTreeNode(); } FeedEngine.SubscribeOpml(opml); mainForm.EndProgress(); Cursor.Current = Cursors.Default; FeedEngine.Start(); }
private void ImportOpmlItem(OpmlItem item) { foreach (OpmlItem childItem in item.ChildItems) { ImportOpmlItem(childItem); } var newLink = new Link { Title = item.Title, Url = item.HtmlUrl, Rss = item.XmlUrl, CategoryId = _categoryID, IsActive = true, NewWindow = false }; // TODO: let user specify and pass as command props // this isn't a valid collision test really if (!_allLinks.Contains(newLink)) { Repository.CreateLink(newLink); } }