示例#1
0
 private void Page_load(object sender, RoutedEventArgs e)
 {
     Album_label.Content  = recievedAlbum;
     Artist_label.Content = recievedArtist;
     try
     {
         string path = Mp3Info.GetFilePath(recievedAlbum, 0);
         AlbumArt.Source = Mp3Info.GetAlbumArt(path);
     }
     catch { }
     loadSongs();
 }
示例#2
0
        private void loadAlbums()
        {
            List <Albums> list = new List <Albums>();

            SQLiteConnection connection = new SQLiteConnection("Data Source=database.db;Version=3;New=False;Compress=True;");

            connection.Open();
            SQLiteCommand command = connection.CreateCommand();

            command.CommandText = "select Album, artist, year from music group by Album";
            SQLiteDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                Albums album = new Albums();
                album.Album  = reader.GetString(0);
                album.Artist = reader.GetString(1);
                try
                {
                    album.image = Mp3Info.GetAlbumArt(Mp3Info.GetFilePath(album.Album, 0));
                }
                catch
                {
                    BitmapImage i = new BitmapImage(new Uri("music-album.png", UriKind.Relative));
                }
                list.Add(album);
            }
            if (!Dispatcher.CheckAccess())
            {
                Dispatcher.Invoke(() =>
                {
                    album_list.ItemsSource = list;
                    //CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(album_list.ItemsSource);
                    //view.SortDescriptions.Add(new SortDescription("Album", ListSortDirection.Ascending));
                });
                return;
            }
            else
            {
                album_list.ItemsSource = list;
                //CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(album_list.ItemsSource);
                //view.SortDescriptions.Add(new SortDescription("Album", ListSortDirection.Ascending));
            }

            connection.Close();
        }
示例#3
0
        private void init(string path)
        {
            song_list.SelectedIndex = (App.Current as App).playlist.PlayIndex;
            song = TagLib.File.Create(path);
            nowPlaying_Title.Content  = song.Tag.Title;
            nowPlaying_Artist.Content = song.Tag.FirstAlbumArtist + " | " + song.Tag.Album;
            timeSpan_Label.Content    = song.Properties.Duration.ToString(@"mm\:ss");
            //progress bar setup
            timeElapsed_progressBar.Maximum = (int)song.Properties.Duration.TotalSeconds;
            timeElapsed_progressBar.Minimum = timeElapsed_progressBar.Value = 0;
            //starting timer
            timer.Interval = TimeSpan.FromSeconds(1);
            timer.Tick    += timer_Tick;
            timer.Start();
            try
            {
                nowPlaying_AlbumArt.Source = Background_image.Source = Mp3Info.GetAlbumArt(path);
            }
            catch { }
            (App.Current as App).player.Volume = volume_Slider.Value;

            //getting lyrics
            try
            {
                //AzLyrics lyrics = new AzLyrics(song.Tag.FirstAlbumArtist, song.Tag.Title);
                //Lyrics_textBlock.Text = lyrics.GetLyris();
                LyricsWikia lyrics = new LyricsWikia(song.Tag.FirstAlbumArtist, song.Tag.Title);
                Lyrics_textBlock.Text = lyrics.GetLyris();
            }
            catch (System.Net.WebException)
            {
                Lyrics_textBlock.Text = "Lyrics not found!";
            }
            catch (Exception ex)
            {
                Lyrics_textBlock.Text = ex.ToString();
            }
        }