コード例 #1
0
        private void RemoveSong(object sender, RoutedEventArgs e)
        {
            var selected = songs.SelectedIndex;

            if (selected == currentIndex)
            {
                currentIndex = 0;
            }
            pl.RemoveSong(pl.songs[selected]);
            songs.Items.Remove(selected);
            UpdateList();
        }
コード例 #2
0
        private void BtnDeleteFile_Click(object sender, EventArgs e)
        {
            List <Song> deleteList = new List <Song>();

            foreach (DataGridViewRow row in DgrPlaylist.SelectedRows)
            {
                deleteList.Add(row.DataBoundItem as Song);
            }

            foreach (var song in deleteList)
            {
                Playlist.RemoveSong(song);
            }

            DgrPlaylist.DataSource = null;
            DgrPlaylist.DataSource = Playlist.SongList;
            DgrPlaylist.ClearSelection();
        }