public void UpdateSong(SongData updatedSong) { foreach (var song in NowPlayingList) { if (song.SongId == updatedSong.SongId) { song.Album = updatedSong.Tag.Album; song.Artist = updatedSong.Tag.Artists; song.Composer = updatedSong.Tag.Composers; song.Rating = (int)updatedSong.Tag.Rating; song.Title = updatedSong.Tag.Title; song.TrackNumber = updatedSong.Tag.Track; song.Year = updatedSong.Tag.Year; DatabaseManager.UpdateNowPlayingSong(updatedSong); NPChange.SendMessageRefreshNP(song.SongId, song.Title, song.Artist); break; } } }
private void Sort(Func <SongItem, object> selector) { int id = -1; if (isNowPlaying) { if (playlist.Count == 0) { return; } id = playlist.ElementAt(index).SongId; } if (ascending) { Playlist = new ObservableCollection <SongItem>(playlist.OrderBy(selector)); } else { Playlist = new ObservableCollection <SongItem>(playlist.OrderByDescending(selector)); } if (isNowPlaying) { int i = 0; foreach (var item in playlist) { if (item.SongId == id) { break; } i++; } index = i; ApplicationSettingsHelper.SaveSongIndex(index); Library.Current.SetNowPlayingList(Playlist); NPChange.SendMessageNPSorted(); } }