コード例 #1
0
ファイル: Library.cs プロジェクト: justinhachemeister/MiSharp
        /// <summary>
        ///     Adds the specified song to the end of the playlist.
        ///     This method is only available in administrator mode.
        /// </summary>
        /// <param name="songList">The songs to add to the end of the playlist.</param>
        public void AddSongsToPlaylist(IEnumerable <Song> songList)
        {
            if (songList == null)
            {
                Throw.ArgumentNullException(() => songList);
            }


            CurrentPlaylist.AddSongs(songList.ToList());
            // Copy the sequence to a list, so that the enumeration doesn't gets modified

            PlaylistChanged.RaiseSafe(this, EventArgs.Empty);
        }
コード例 #2
0
ファイル: Library.cs プロジェクト: justinhachemeister/MiSharp
        /// <summary>
        ///     Adds the song to the end of the playlist.
        ///     This method throws an exception, if there is an outstanding timeout.
        /// </summary>
        /// <param name="song">The song to add to the end of the playlist.</param>
        public void AddSongToPlaylist(Song song)
        {
            if (song == null)
            {
                Throw.ArgumentNullException(() => song);
            }

            if (CurrentPlaylist == null)
            {
                CurrentPlaylist = new Playlist("Default");
            }
            CurrentPlaylist.AddSongs(new[] { song });

            PlaylistChanged.RaiseSafe(this, EventArgs.Empty);
        }