Ejemplo n.º 1
0
 /// <summary>
 /// Add a playlist
 /// </summary>
 /// <param name="playlist">The Playlist to add to the list</param>
 public void Add(Playlist playlist)
 {
     if (!playlists.Contains(playlist))
     {
         playlists.Add(playlist);
     }
 }
Ejemplo n.º 2
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (tbName.TextLength < 1)
            {
                MessageBox.Show("Er is geen naam opgegeven!");
                return;
            }

            if(lbSongs.SelectedItems.Count == 0)
            {
                MessageBox.Show("Er zijn geen songs geselecteerd!");
                return;
            }

            foreach (Playlist p in musicplayer.Playlists())
            {
                if (p.Name == tbName.Text)
                {
                    MessageBox.Show("Playlist met dezelfde naam bestaat al!");
                    return;
                }
            }

            Playlist playlist = new Playlist(tbName.Text);

            foreach(Song s in lbSongs.SelectedItems)
            {
                playlist.Add(s);
            }

            musicplayer.Add(playlist);

            this.Close();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Construct the Music Player
        /// </summary>
        public MusicPlayer()
        {
            artists = new List<Artist>();
            songs = new List<Song>();
            playlists = new List<Playlist>();

            wplayer = new WMPLib.WindowsMediaPlayer();

            currentlyPlaying = null;
            currentlyPlayingList = null;
        }
Ejemplo n.º 4
0
        private void InitializeTestData()
        {
            Artist[] artist = new Artist[4];

            artist[0] = new Artist("artiest 1", DateTime.Now);
            artist[1] = new Artist("artiest 2", DateTime.Now);
            artist[2] = new Artist("artiest 3", DateTime.Now);
            artist[3] = new Artist("artiest 4", DateTime.Now);

            foreach (Artist a in artist)
            {
                musicplayer.Add(a);
            }

            Song[] song = new Song[16];

            song[0] = (new Song("song 1", 2015, artist[0], @"C:\Downloads\Audiomachine - Chronicles 2012\02 - Reaching.mp3"));
            song[1] = (new Song("song 2", 2015, artist[0], @"C:\Downloads\Audiomachine - Chronicles 2012\02 - Reaching.mp3"));
            song[2] = (new Song("song 3", 2015, artist[0], @"C:\Downloads\Audiomachine - Chronicles 2012\02 - Reaching.mp3"));
            song[3] = (new Song("song 4", 2015, artist[0], @"C:\Downloads\Audiomachine - Chronicles 2012\02 - Reaching.mp3"));

            song[4] = (new Song("song 5", 2015, artist[1], @"C:\Downloads\Audiomachine - Chronicles 2012\02 - Reaching.mp3"));
            song[5] = (new Song("song 6", 2015, artist[1], @"C:\Downloads\Audiomachine - Chronicles 2012\02 - Reaching.mp3"));
            song[6] = (new Song("song 7", 2015, artist[1], @"C:\Downloads\Audiomachine - Chronicles 2012\02 - Reaching.mp3"));
            song[7] = (new Song("song 8", 2015, artist[1], @"C:\Downloads\Audiomachine - Chronicles 2012\02 - Reaching.mp3"));

            song[8] = (new Song("song 9", 2015, artist[2], @"C:\Downloads\Audiomachine - Chronicles 2012\02 - Reaching.mp3"));
            song[9] = (new Song("song 10", 2015, artist[2], @"C:\Downloads\Audiomachine - Chronicles 2012\02 - Reaching.mp3"));
            song[10] = (new Song("song 11", 2015, artist[2], @"C:\Downloads\Audiomachine - Chronicles 2012\02 - Reaching.mp3"));
            song[11] = (new Song("song 12", 2015, artist[2], @"C:\Downloads\Audiomachine - Chronicles 2012\02 - Reaching.mp3"));

            song[12] = (new Song("song 13", 2015, artist[3], @"C:\Downloads\Audiomachine - Chronicles 2012\02 - Reaching.mp3"));
            song[13] = (new Song("song 14", 2015, artist[3], @"C:\Downloads\Audiomachine - Chronicles 2012\02 - Reaching.mp3"));
            song[14] = (new Song("song 15", 2015, artist[3], @"C:\Downloads\Audiomachine - Chronicles 2012\02 - Reaching.mp3"));
            song[15] = (new Song("song 16", 2015, artist[3], @"C:\Downloads\Audiomachine - Chronicles 2012\02 - Reaching.mp3"));

            foreach (Song s in song)
            {
                musicplayer.Add(s);
            }

            Playlist[] playlist = new Playlist[2];

            playlist[0] = new Playlist("list 1");
            playlist[1] = new Playlist("list 2");

            for (int p = 0; p < 2; ++p)
            {
                for (int i = 0; i < 8; ++i)
                {
                    playlist[p].Add(song[p * 8 + i]);
                }
            }

            foreach (Playlist p in playlist)
            {
                musicplayer.Add(p);
            }

            UpdateArtistList();
            UpdateSongList();
            UpdatePlayList();
        }
Ejemplo n.º 5
0
 public Player()
 {
     _playlist = new Playlist();
 }
Ejemplo n.º 6
0
 public Player(Playlist playlist)
 {
     this._playlist            = playlist;
     this._currentPlayingIndex = 0;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Remove a playlist
 /// </summary>
 /// <param name="playlist">The playlist to remove from the list</param>
 public void Remove(Playlist playlist)
 {
     if(playlists.Contains(playlist))
     {
         playlists.Remove(playlist);
     }
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Play a playlist
        /// </summary>
        /// <param name="playlist">The playlist to play</param>
        public void Play(Playlist playlist)
        {
            if(currentlyPlayingList == playlist)
            {
                currentlyPlaying = currentlyPlayingList.PlayFirstOrNextSong();
            }
            else
            {
                if (currentlyPlayingList != null)
                {
                    currentlyPlayingList.StopPlaying();
                }

                currentlyPlayingList = playlist;
                currentlyPlaying = currentlyPlayingList.PlayFirstOrNextSong();
            }

            PlayUrl(currentlyPlaying);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Play a song
        /// </summary>
        /// <param name="song">The song to play</param>
        public void Play(Song song)
        {
            if (currentlyPlayingList != null)
            {
                currentlyPlayingList.StopPlaying();
                currentlyPlayingList = null;
            }

            currentlyPlaying = song;

            PlayUrl(currentlyPlaying);
        }