// Divide tracks into albums and artists // TODO muuta parsintakohtaan private void DivideTracks() { Artists.Clear(); Artist lastArtist = null; // Nopeuttamaan hakua foreach (Track track in AllTracks) { if (lastArtist != null && lastArtist.Name.Equals(track.Artist)) { lastArtist.AddSong(track); } else { if (Artists.TryGetValue(track.Artist, out lastArtist)) { lastArtist.AddSong(track); } else { lastArtist = new Artist() { Name = track.Artist }; lastArtist.AddSong(track); Artists.Add(track.Artist, lastArtist); } } } }
// Go back, if possible private void GoBack() { SelectedArtist = null; if (NavigationService.CanGoBack) NavigationService.GoBack(); }