Пример #1
0
            public void AddSongToPlaylist()
            {
                _playlistManager.CreatePlaylist(playlist1);
                _playlistManager.CreatePlaylist(playlist2);

                Assert.DoesNotThrow(() => _playlistManager.AddSongToPlaylist(playlist1.Name, ""));
                Assert.DoesNotThrow(() => _playlistManager.RemoveSongFromPlaylist(playlist1.Name, ""));
            }
        private void AddSongToPlaylist(object sender, RoutedEventArgs e)
        {
            AddSongToPlaylist dialog = new AddSongToPlaylist(_playlistManager);

            dialog.ShowDialog();

            if (dialog.DialogResult == true)
            {
                try
                {
                    string namePlaylist = dialog.ListBox.SelectedItem.ToString();
                    string pathToSong   = _libraryManager.GetSongManager().GetSongByName(DetailListing.SelectedItem.ToString()).Path;

                    _playlistManager.AddSongToPlaylist(namePlaylist, pathToSong);
                }
                catch (Exception ex)
                {
                    new AlertMessage(ex.Message, ex.StackTrace).ShowDialog();
                }
            }
        }
Пример #3
0
 /// <inheritdoc/>
 public void AddSongToSelectedPlaylist(Song song)
 {
     SelectedPlaylist.Songs = _playlistManager.AddSongToPlaylist(SelectedPlaylist.Name, song);
     OnPropertyChanged(() => SelectedPlaylist);
 }