Exemplo n.º 1
0
        public void MoveToPrevSong()
        {
            if (!SongArchive.Any())
            {
                return;
            }

            // shrink list of upcoming songs
            UpcomingSongs.Insert(0, CurrentSong);
            UpcomingSongs.Remove(UpcomingSongs.Last());

            // reassign current song (take last song from archive)
            CurrentSong = SongArchive.Last();

            // update archive
            SongArchive.Remove(SongArchive.Last());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Switching to previous song is done synchronously
        /// since his operation is very cheap (just recombinate songs in collections)
        /// </summary>
        public Task MoveToPrevSongAsync()
        {
            if (SongArchive.Any())
            {
                // shrink list of upcoming songs
                UpcomingSongs.Insert(0, CurrentSong);
                UpcomingSongs.Remove(UpcomingSongs.Last());

                // reassign current song (take last song from archive)
                CurrentSong = SongArchive.Last();

                // update archive
                SongArchive.Remove(SongArchive.Last());
            }

            return(Task.CompletedTask);
        }