Example #1
0
        private void UserClickedOnPlay(object sender, EventArgs e)
        {
            configure_firebase();

            Song_Form song_form = (Song_Form)sender;
            Song      s         = song_form.Song;
            int       i         = 0;
            int       counter   = 0;

            foreach (Control control in flowLayoutPanel1.Controls)
            {
                if (control.GetType() == typeof(Song_Form))
                {
                    Song_Form sf = (Song_Form)control;
                    if (sf == song_form)
                    {
                        int    cnt  = i + 1;
                        string path = @"Downloaded Songs\" + sf.Song.Name + ".mp3";
                        File.Delete(path);
                        flowLayoutPanel1.Controls.Remove(sf);
                        client.Delete(@"Song/" + cnt);

                        updateAll(i + 1);
                    }

                    i++;
                }
            }
        }
Example #2
0
        private void UserClickedOnPlay(object sender, EventArgs e)
        {
            //slider.Value = 0;

            pauseSong(currentlyPlaying_pos);
            Song_Form song_form = (Song_Form)sender;

            playCurrentSong(song_form);

            int i = 0;

            foreach (Control control in flowLayoutPanel1.Controls)
            {
                if (control.GetType() == typeof(Song_Form))
                {
                    Song_Form sf = (Song_Form)control;
                    Song      s  = sf.Song;
                    if (sf == song_form)
                    {
                        currentlyPlaying_pos = i;
                    }
                    i++;
                }
            }
        }
Example #3
0
        private void loadPlaylist()
        {
            foreach (Song song in this.playlist)
            {
                if (i == 0) //also play it
                {
                    pictureBox1.Image = getImage(song.Picture);
                    songLabel.Text    = song.Name;
                    artistLabel.Text  = song.Artist;
                    currentlyPlaying  = song;

                    downloaded(song);

                    string path = @"Downloaded Songs\" + song.Name + ".mp3";
                    player.URL = path;
                    //player.controls.play(); //play the song

                    Song_Form sf = new Song_Form(); //display in flowlayoutpanel
                    sf.Song = song;
                    sf.loadSong();

                    sf.makeButt_invisible();

                    if (i % 2 == 0)
                    {
                        sf.BackColor = light_blue;
                    }
                    else
                    {
                        sf.BackColor = dark_blue;
                    }


                    flowLayoutPanel1.Controls.Add(sf);
                }
                else//just add it into the list
                {
                    Song_Form sf = new Song_Form(); //display in flowlayoutpanel
                    sf.Song = song;
                    sf.loadSong();

                    if (i % 2 == 0)
                    {
                        sf.BackColor = light_blue;
                    }
                    else
                    {
                        sf.BackColor = dark_blue;
                    }

                    flowLayoutPanel1.Controls.Add(sf);
                }

                i++;
            }
        }
Example #4
0
        private void playCurrentSong(Song_Form sf)
        {
            Song song = sf.Song;

            sf.makeButt_invisible();

            pictureBox1.Image = getImage(song.Picture);
            songLabel.Text    = song.Name;
            artistLabel.Text  = song.Artist;
            currentlyPlaying  = song;

            downloaded(song);

            string path = @"Downloaded Songs\" + song.Name + ".mp3";

            player.URL = path;
            player.controls.play();
        }
Example #5
0
        private void pauseSong(int pos)
        {
            int i = 0;

            foreach (Control control in flowLayoutPanel1.Controls)
            {
                if (control.GetType() == typeof(Song_Form))
                {
                    if (i == pos)
                    {
                        Song_Form sf = (Song_Form)control;
                        sf.makeButt_visible();
                        return;
                    }

                    i++;
                }
            }
        }
Example #6
0
        private void loadPlaylist()
        {
            foreach (Song song in this.playlist)
            {
                Song_Form sf = new Song_Form(); //display in flowlayoutpanel
                sf.Song = song;
                sf.loadSong();

                if (i % 2 == 0)
                {
                    sf.BackColor = light_blue;
                }
                else
                {
                    sf.BackColor = dark_blue;
                }

                flowLayoutPanel1.Controls.Add(sf);
                i++;
            }
        }
Example #7
0
        private void skip_back_Click(object sender, EventArgs e)
        {
            //slider.Value = 0;

            currentlyPlaying_pos--;

            if (currentlyPlaying_pos == playlist.Count - 1)
            {
                pauseSong(0);
            }
            else if (currentlyPlaying_pos == -1)
            {
                pauseSong(0);
                currentlyPlaying_pos = playlist.Count - 1;
            }
            else
            {
                pauseSong(currentlyPlaying_pos + 1);
            }

            int i = 0;

            foreach (Control control in flowLayoutPanel1.Controls)
            {
                if (control.GetType() == typeof(Song_Form))
                {
                    Song_Form sf = (Song_Form)control;

                    if (i == currentlyPlaying_pos)
                    {
                        playCurrentSong(sf);
                        break;
                    }

                    i++;
                }
            }
        }