示例#1
0
        private void cmdAddSongToPlaylist_Click(object sender, EventArgs e)
        {
            String plName = Microsoft.VisualBasic.Interaction.InputBox("Playlist Name:");
            String owner = Microsoft.VisualBasic.Interaction.InputBox("Owner:");

            PlaylistModel playlistModel = new PlaylistModel();
            Playlist thePlaylist = playlistModel.getPlaylist(plName, owner);

            SongModel songModel = new SongModel();
            String artist = Microsoft.VisualBasic.Interaction.InputBox("Search for Artist: ");
            List<Song> songs = songModel.getSongsByArtist(artist);

            Song theSong = new Song();

            if (songs.Count > 0)
            {
                theSong = songs[0];
                if (thePlaylist != null)
                {
                    playlistModel.addSongToPlaylist(thePlaylist, theSong);
                }
            }
        }
        private void goToPlaylist(object sender, EventArgs e)
        {
            Label theLabel = (Label)sender;
            int index = int.Parse(theLabel.Tag.ToString());
            String playlistName = playlistLabelName[index].Text;
            String owner = playlistLabelOwner[index].Text;

            PlaylistModel playlistModel = new PlaylistModel();
            Playlist thePlaylist = playlistModel.getPlaylist(playlistName, owner);

            parent.showViewPlaylist(thePlaylist);

            this.Close();
        }