Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
0
        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);
        }
Example #4
0
        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);
        }
Example #5
0
        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();
            }
        }
Example #6
0
        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;
            }
        }
Example #7
0
        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;
            }
        }
Example #8
0
 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;
 }
Example #9
0
 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();
     }
 }
Example #10
0
        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;
        }