public Form1(string URI) { InitializeComponent(); Content = new Spofity(URI); Content.BeginLoading += new Spofity.ActionEvent(Content_BeginLoading); Content.FinishedLoading += new Spofity.ActionEvent(FinishedLoad); Content.LoadData(); timer2.Start(); }
/// <summary> /// Creates a form by predifined URI; /// </summary> /// <param name="URI"></param> public Form1(string URI) { Sects = new Dictionary<string, UserControl>(); newElements = new Stack<Element>(); elements = new Dictionary<string, Control>(); InitializeComponent(); if(URI=="") { hasContent=false; return; } string source = GetSource(URI); if (source == "") { hasContent = false; return; } /* Skybound.Gecko.Xpcom.Initialize(); D = new SpotiBrowsser.Browser(source); D.Show(); D.BrowserLoad(); D.webBrowser1.Navigated += new Skybound.Gecko.GeckoNavigatedEventHandler(webBrowser1_Navigated); D.webBrowser1.Navigating += new Skybound.Gecko.GeckoNavigatingEventHandler(webBrowser1_Navigating); /* foreach (HtmlElement RN in D.webBrowser1.Document.GetElementsByTagName("a")) { if (RN.OffsetRectangle.Y < 320) { SpotiBrowsser.Browser B = new SpotiBrowsser.Browser(RN.GetAttribute("href")); AddSection(RN.InnerText, B); } }*/ feeds = new List<Feed>(); Sects = new Dictionary<string, UserControl>(); this.ShowInTaskbar = false; this.Text = "Custom Spotifyview"; try { Spofity D; newElements = new Stack<Element>(); elements = new Dictionary<string, Control>(); string domain = "localhost"; XmlDocument RS = new XmlDocument(); string appPath = Application.LocalUserAppDataPath + "\\" + URI; try { RS.Load("http://" + domain + "/quote.php?q=" + URI + ""); using (StreamWriter SW = new StreamWriter(appPath)) { SW.Write(RS.InnerText); SW.Close(); } } catch { if (File.Exists(Application.LocalUserAppDataPath + "\\" + URI)) { D = new Spofity(appPath); this.Show(); } else { this.hasContent = false; return; } } D = new Spofity("http://" + domain + "/quote.php?q=" + URI + ""); foreach (Section R in D.View.Sections) { UserControl F = new UserControl(); Sects.Add(R.Name, F); F.Dock = DockStyle.Fill; pane X = new pane(); X.Sect = F; X.panel1 = this.panel1; X.Label = R.Name; X.Dock = DockStyle.Left; foreach (Element Ds in R.Elements) { Ds.Attributes.Add(new Attribute() { name = "section", value = R.Name }); newElements.Push(Ds); } this.panel1.Controls.Add(X); this.ContentPanel.Controls.Add(F); X.Show(); } this.hasContent = true; this.Show(); this.label1.Text = this.Text; } catch { this.hasContent = false; } }
void F() { try { if (newElements.Count == 0) { Spofity D = new Spofity("http://localhost/quote.php?q=" + this.nspace); foreach (Section R in D.View.Sections) { foreach (Element Ds in R.Elements) { Ds.Attributes.Add(new Attribute() { name = "section", value = R.Name }); newElements.Push(Ds); } } } } catch { } }
public Form1(string URI) { if(URI=="") { hasContent=false; return; } InitializeComponent(); this.nspace = URI; // feeds = new List<Feed>(); Sects = new Dictionary<string, UserControl>(); this.ShowInTaskbar = false; this.Text = "Custom Spotifyview"; try { Spofity D; newElements = new Stack<Element>(); elements = new Dictionary<string, Control>(); string domain = "localhost"; XmlDocument RS = new XmlDocument(); string appPath = Application.LocalUserAppDataPath + "\\" + URI; try { RS.Load("http://" + domain + "/quote.php?q=" + URI + ""); using (StreamWriter SW = new StreamWriter(appPath)) { SW.Write(RS.InnerText); SW.Close(); } } catch { if (File.Exists(Application.LocalUserAppDataPath + "\\" + URI)) { D = new Spofity(appPath); this.Show(); } else { this.hasContent = false; return; } } D = new Spofity("http://" + domain + "/quote.php?q=" + URI + ""); foreach (Section R in D.View.Sections) { UserControl F = new UserControl(); Sects.Add(R.Name, F); F.Dock = DockStyle.Fill; pane X = new pane(); X.Sect = F; X.panel1 = this.panel1; X.Label = R.Name; X.Dock = DockStyle.Left; foreach (Element Ds in R.Elements) { Ds.Attributes.Add(new Attribute() { name = "section", value = R.Name }); newElements.Push(Ds); } this.panel1.Controls.Add(X); this.ContentPanel.Controls.Add(F); X.Show(); } this.hasContent = true; this.Show(); this.label1.Text = this.Text; } catch { this.hasContent = false; } }