private void addPlaylistBtn_Clicked(object sender, RoutedEventArgs e) { AddPlaylist addPlaylistWindow = new AddPlaylist(); addPlaylistWindow.Owner = this; addPlaylistWindow.ShowDialog(); if (addPlaylistWindow.DialogResult == true) { string newPlaylistName = addPlaylistWindow.newPlaylistName; if (musicLib.PlaylistExists(newPlaylistName)) { MessageBox.Show("There is already a playlist with that name"); } else { musicLib.AddPlaylist(newPlaylistName); List <string> updatedPlaylists = new List <string>(); updatedPlaylists.Add("All Music"); updatedPlaylists.AddRange(musicLib.Playlists); playlistList.ItemsSource = updatedPlaylists; } } }
private void NewPlaylist_Click(object sender, RoutedEventArgs e) { addPlaylistWindow = new AddPlaylist(); addPlaylistWindow.ShowDialog(); if(addPlaylistWindow.OKClicked) { musicLibrary.AddPlaylist(addPlaylistWindow.PlayListName); playlistListBox.ItemsSource = musicLibrary.Playlists; } }