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()); }
/// <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); }