コード例 #1
0
ファイル: Copy of Form1.cs プロジェクト: krikelin/Spotiapps
 /// <summary>
 /// Adds a new view to the Spotify view and returns the UserControl associated with the view.
 /// 
 /// </summary>
 /// <param name="name">The name of the view</param>
 /// <returns>The UserControl belonging to the view</returns>
 public UserControl AddSection(string name,UserControl playLists)
 {
     pane Playlists = new pane();
     Playlists.Sect = playLists;
     Playlists.Label = name;
     Playlists.Dock = DockStyle.Left;
     Playlists.panel1 = this.panel1;
     Playlists.Width = Playlists.Label1.Width > 80 ? Playlists.Label1.Width+20 : 80;
     Playlists.Label1.Left = Playlists.Width / 4;
     playLists.Dock = DockStyle.Fill;
     this.panel1.Controls.Add(Playlists);
     this.ContentPanel.Controls.Add(playLists);
     Sects.Add(name, playLists);
     Playlists.Sect = playLists;
     return playLists;
 }
コード例 #2
0
ファイル: Copy of Form1.cs プロジェクト: krikelin/Spotiapps
 public void AddSection(string name)
 {
     pane D = new pane();
     D.Click += new EventHandler(D_Click);
 }
コード例 #3
0
ファイル: Copy of Form1.cs プロジェクト: krikelin/Spotiapps
        /// <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;
             }
        }
コード例 #4
0
ファイル: Copy of Form1.cs プロジェクト: krikelin/Spotiapps
 /// <summary>
 /// Set the current view view (Depredicted)
 /// </summary>
 /// <remarks>Depredicted</remarks>
 /// <param name="view"></param>
 public void SetView(pane view)
 {
     view.Active = true;
     foreach (Control X in elements.Values)
     {
         if (((Element)X.Tag).GetAttribute("section") == view.Label)
         {
             X.Show();
         }
         else
         {
             X.Hide();
         }
     }
 }
コード例 #5
0
ファイル: Copy of Form1.cs プロジェクト: krikelin/MediaChrome
        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);

                            }
                        }
                }
            }
        }
コード例 #6
0
ファイル: TestForm.cs プロジェクト: krikelin/Spotiapps
        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;
            }
        }