public MainForm() { D = new Home(); E = new Browse(this); AddSection("Home", D); SetActiveSection("Home"); AddSection("Emotionalizer",E); Feed Dx = new Feed(); Dx.Name = "News"; AddFeed("Home", "sp:entry", "http://www.spotify.com/se/blog/atom/", 5, new Point(32, 140), "News", A); }
void D_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { XmlDocument D = new XmlDocument(); XmlDocument RS = new XmlDocument(); RS.LoadXml(e.Result); foreach(XmlElement RN in RS.GetElementsByTagName("element")) { Element El = new Element(0,0,0,0); El.Feed = currentFeed.Name; foreach (XmlElement RNS in RN.GetElementsByTagName("attribute")) { Attribute r = new Attribute(); r.name = RNS.GetAttribute("name"); r.value = RNS.GetAttribute("value"); El.Attributes.Add(r); } newElements.Push(El); } currentFeed = null; }
public void UpdateFeed(Feed feed) { if (currentFeed != null) { return; } currentFeed = feed; Stack<Control> removeControls = new Stack<Control>(); foreach (Control x in this.ContentPanel.Controls) { foreach (Control i in x.Controls) { if (i.Tag.GetType() == typeof(Element)) { if (((Element)i.Tag).Feed == feed.Name) { removeControls.Push(i); } } } } while (removeControls.Count > 0) { Control d = removeControls.Pop(); d.Parent.Controls.Remove(d); } WebClient D = new WebClient(); D.DownloadStringCompleted+=new DownloadStringCompletedEventHandler(D_DownloadStringCompleted); D.DownloadStringAsync(new Uri(feed.URL)); }
private void LoadFile() { Feeds = new Dictionary<string, Feed>(); if (!File.Exists(Application.UserAppDataPath + "\\feeds.csv")) { using (StreamWriter SR = new StreamWriter(Application.UserAppDataPath + "\\feeds.csv")) { SR.WriteLine(""); SR.Close(); } } try { using (StreamReader SR = new StreamReader(Application.UserAppDataPath + "\\feeds.csv")) { String S; while ((S = SR.ReadLine()) != null) { if (S != "") { string[] dr = S.Split(';'); Feed R = new Feed(this) { Uri = new Uri(dr[1]) }; DateTime MR; if (DateTime.TryParse(dr[0], out MR)) R.Hour = MR; int days = 0; if (int.TryParse(dr[2], out days)) R.Day = days; Feeds.Add(S, R); } } } } catch { } }
public void AddFeed(string URI) { Feed A = new Feed(this); A.Uri = new Uri(URI); A.LastHeadline = ""; }