示例#1
0
        private void renameCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            AddPlaylistDialogBox newPlaylistDialogBox = new AddPlaylistDialogBox(PlaylistDialogType.Create);

            newPlaylistDialogBox.ShowDialog();
            if (newPlaylistDialogBox.DialogResult == true)
            {
                bool successfulAdd = musicLib.RenamePlaylist(playlistBox.SelectedItem.ToString(), newPlaylistDialogBox.PlaylistName);
                newPlaylistDialogBox.Close();
                if (successfulAdd)
                {
                    playlistBox.ItemsSource = musicLib.Playlists;
                    musicLib.Save();
                }
                else
                {
                    MessageBox.Show("A playlist with this name already exists.", "Uh Oh!", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                }
            }
        }
示例#2
0
        private void addPlaylist_Click(object sender, RoutedEventArgs e)
        {
            AddPlaylistDialogBox newPlaylistDialogBox = new AddPlaylistDialogBox(PlaylistDialogType.Create);

            newPlaylistDialogBox.ShowDialog();
            if (newPlaylistDialogBox.DialogResult == true)
            {
                bool successfulAdd = musicLib.AddPlaylist(newPlaylistDialogBox.PlaylistName);
                newPlaylistDialogBox.Close();
                if (successfulAdd)
                {
                    musicLib.Save();

                    playlistBox.ItemsSource = musicLib.Playlists;
                }
                else
                {
                    MessageBox.Show("A playlist with this name already exists.", "Uh Oh!", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                }
            }
        }