public Track[] GetPlaylistTracks(int ID)
        {
            //Sorting mess
            PlayList organizer = new PlayList(ID);
            organizer.PlayListSyncOrder();
            List<Track> orderedList = new List<Track>();
            List<Track> unorderedList = DataAccess.Instance.GetTracksInPlaylist(ID);
            Track hold;

            for (int i = 0; i < organizer.PlayListTrackIds.Count; i++)
            {
                hold = unorderedList.Find(x => x.TrackId == organizer.PlayListTrackIds[i]);
                orderedList.Add(hold);
            }

            return orderedList.ToArray<Track>();
            //return DataAccess.Instance.GetTracksInPlaylist(ID).ToArray<Track>();
        }
Exemplo n.º 2
0
        public void ReloadPlaylistTracksListBox()
        {
            PlayList selectedPlaylist;
            string song, artist;

            if (ddlPlaylistSelection.SelectedIndex > 0)
            {
                selectedPlaylist = new PlayList((currentUser.MyPlaylistIds)[ddlPlaylistSelection.SelectedIndex - 1]);
                selectedPlaylist.PlayListSyncOrder();
                Session["PlaylistId"] = selectedPlaylist.PlaylistID;
                cbxEditPlaylistPublic.Checked = selectedPlaylist.IsPublic;

                //populates listbox lbPlaylistTracks with tracks from the actively selected playlist
                lbPlaylistTracks.Items.Clear();
                for (int i = 0; i < selectedPlaylist.PlayListTrackIds.Count; i++)
                {
                    song = DataAccess.Instance.GetSongName(selectedPlaylist.PlayListTrackIds[i]);
                    artist = DataAccess.Instance.GetArtist(selectedPlaylist.PlayListTrackIds[i]);
                    lbPlaylistTracks.Items.Add(new ListItem(song + "          -  " + artist, i.ToString()));
                }
            }
            else
                Session["PlaylistId"] = null;
        }