private static bool Compare(QueriedSong apple, QueriedSong orange) { if (apple.Score > orange.Score) return false; if (apple.Score < orange.Score) return true; return (apple.dt > orange.dt); }
private Playlist setPlaylistData(QueriedSong song, int state) { Playlist p = new Playlist(); p.AlbumName = song.Album; p.ArtistName = song.Artist; p.songid = song.SongId; p.SongName = song.SongName; p.State = state; return(p); }
private QueriedSong setData(QueriedSong qs, Song md, DateTime dt) { qs.Album = md.AlbumName; qs.Artist = md.ArtistName; qs.Path = md.PathString; qs.SongName = md.SongName; qs.SongId = md.Id; qs.dt = dt; return(qs); }
private static bool Compare(QueriedSong apple, QueriedSong orange) { if (apple.Score > orange.Score) { return(false); } if (apple.Score < orange.Score) { return(true); } return(apple.dt > orange.dt); }
private async void readVotes() { List <TodoItem> votes = await cFunctions.DownloadVoteQueue(); foreach (TodoItem vote in votes) { //Get Vote info Song song = await cFunctions.SearchSongID(vote.songid); if (song != null) { int contains = -1; for (int i = 0; i < upcoming.Count; i++) { if (upcoming[i].Path == song.PathString) { contains = i; } } if (contains == -1) { QueriedSong qs = new QueriedSong(); setData(qs, song, vote.__createdAt); qs.Score = 1; upcoming.Add(qs); } else { QueriedSong qs = upcoming[contains]; qs.Score++; upcoming[contains] = qs; } } else { MessageBox.Show(Properties.Resources.notFound); } } upcoming = sortUpcoming(upcoming); Play_List.ItemsSource = upcoming; if (waveOutDevice.PlaybackState == PlaybackState.Stopped) { playSongs(); } }
private void startPlay() { if (upcoming.Count > 0) { isDirty = true; audioFileReader = new AudioFileReader(upcoming[0].Path); waveOutDevice.Init(audioFileReader); waveOutDevice.Play(); currentSong = upcoming[0]; Song_Status.Content = Properties.Resources.nowPlaying + currentSong.SongName + Properties.Resources.nowPlaying_transition + currentSong.Artist; if (upcoming.Count > 0) { upcoming.RemoveAt(0); } Play_List.ItemsSource = upcoming; isDirty = true; } }
private Playlist setPlaylistData(QueriedSong song, int state) { Playlist p = new Playlist(); p.AlbumName = song.Album; p.ArtistName = song.Artist; p.songid = song.SongId; p.SongName = song.SongName; p.State = state; return p; }
private async void readVotes() { List<TodoItem> votes = await cFunctions.DownloadVoteQueue(); foreach (TodoItem vote in votes) { //Get Vote info Song song = await cFunctions.SearchSongID(vote.songid); if (song != null) { int contains = -1; for (int i = 0; i < upcoming.Count; i++) { if (upcoming[i].Path == song.PathString) { contains = i; } } if (contains == -1) { QueriedSong qs = new QueriedSong(); setData(qs, song, vote.__createdAt); qs.Score = 1; upcoming.Add(qs); } else { QueriedSong qs = upcoming[contains]; qs.Score++; upcoming[contains] = qs; } } else { MessageBox.Show(Properties.Resources.notFound); } } upcoming = sortUpcoming(upcoming); Play_List.ItemsSource = upcoming; if (waveOutDevice.PlaybackState == PlaybackState.Stopped) { playSongs(); } }
private QueriedSong setData(QueriedSong qs, Song md, DateTime dt) { qs.Album = md.AlbumName; qs.Artist = md.ArtistName; qs.Path = md.PathString; qs.SongName = md.SongName; qs.SongId = md.Id; qs.dt = dt; return qs; }