示例#1
0
        void FinishedLoad()
        {
            this.label1.Text = "Finished";
            for (int i = Content.View.Sections.Count - 1; i >= 0; i--)
            {
                Section d = Content.View.Sections[i];
                pane D = new pane();
                D.Label = d.Name;
                D.Show();
                D.Dock = DockStyle.Left;
                D.Width = 75;
                D.Height = this.panel1.Height;
                D.Sect = new Panel();
                panel1.Controls.Add(D);
                D.panel1 = this.panel1;
                this.contentPanel.Controls.Add(D.Sect);
                D.Sect.Dock = DockStyle.Fill;
                D.S ect.Show();

                if (i == 0)
                {
                    D.Sect.Visible = true;
                }
                foreach (Element a in d.Elements)
                {
                    Control Ds = new Control();
                    switch (a.Type)
                    {
                        case "sp:group":
                            spotifyPanel sp = new spotifyPanel();
                            sp.Label = a.GetAttribute("label");
                            sp.Width = int.Parse(a.GetAttribute("width"));
                            sp.Height = int.Parse(a.GetAttribute("height"));
                            sp.Left = int.Parse(a.GetAttribute("x"));
                            sp.Top = int.Parse(a.GetAttribute("y"));
                            D.Sect.Controls.Add(sp);
                            sp.Show();
                            Ds = sp;
                            break;
                        case "sp:label":
                            Label spx = new Label();
                            if (a.GetAttribute("autoSize") != "")
                            {
                                spx.AutoSize = bool.Parse(a.GetAttribute("autoSize"));

                            }

                            spx.Text = a.GetAttribute("label");
                            spx.Width = int.Parse(a.GetAttribute("width"));
                            spx.Height = int.Parse(a.GetAttribute("height"));
                            spx.Left = int.Parse(a.GetAttribute("x"));
                            spx.Top = int.Parse(a.GetAttribute("y"));

                            spx.ForeColor = Color.Gray;
                            spx.BackColor = Color.Transparent;

                            D.Sect.Controls.Add(spx);
                            spx.Show();
                            Ds = spx;
                            break;

                        default:
                            break;
                    }
                    top += Ds.Height;

                }

                if (i == 0)
                {
                    D.label1_MouseDown((object)D, new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0));
                }
                foreach (Control spx in D.Sect.Controls)
                {
                    if (spx.GetType() == typeof(Label))
                        foreach (Control Cont in D.Sect.Controls)
                        {
                            if (Cont.GetType() == typeof(spotifyPanel))
                            {

                                spotifyPanel SD = (spotifyPanel)Cont;
                                if (spx.Left > SD.Left && spx.Top > SD.Top && spx.Left < SD.Width + SD.Left && spx.Top < SD.Height + SD.Top)

                                    spx.ForeColor = Color.Black;
                                spx.BackColor = Color.FromArgb(104, 104, 104);

                            }
                        }
                }
            }
        }
示例#2
0
        /// <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;
             }
        }
示例#3
0
        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;
            }
        }