ChobiQ.DoubanFMAPICodePack.PlayHistory.AddSong C# (CSharp) Метод

AddSong() публичный Метод

public AddSong ( Song song, PlayOperation operation ) : void
song Song
operation PlayOperation
Результат void
        public void AddSong(Song song, PlayOperation operation)
        {
            _history.Enqueue(new HistoryItem()
            {
                SongID = song.SongID,
                TypeCode = DataConvert.ToTypeCode(operation)
            });

            if (_history.Count > 20)
                _history.Dequeue();
        }

Usage Example

Пример #1
0
        //Removes current playing song then adds to play history.
        private Song DequeueToHistory(PlayOperation operationType)
        {
            if (_playlist.Count > 0)
            {
                var song = _playlist.Dequeue();
                _history.AddSong(song, operationType);

                if (_playlist.Count == 1)
                {
                    PlaylistRequest request = new PlaylistRequest(
                        _status, _history, PlayOperation.PlayingLast,
                        CurrentChannel, CurrentSong);

                    var resp = request.GetResponse();

                    ExtractPlaylist(resp, false);
                }

                return(song);
            }
            else
            {
                return(null);
            }
        }