private void AlbumList_Play_Click(object sender, MouseButtonEventArgs e) { var s = album_list.SelectedItem as Albums; string album = s.Album; List <string> paths = new List <string>(); SQLiteConnection connection = new SQLiteConnection("Data Source=database.db;Version=3;New=False;Compress=True;"); connection.Open(); SQLiteCommand command = connection.CreateCommand(); command.CommandText = "select Title, duration from music where album='" + album + "';"; SQLiteDataReader reader = command.ExecuteReader(); while (reader.Read()) { string title = reader.GetString(0); paths.Add(Mp3Info.GetFilePath(title)); } if ((App.Current as App).paths != null) { (App.Current as App).paths.Clear(); } (App.Current as App).paths = paths; (App.Current as App).startIndex = 0; nowPlaying_Page page = new nowPlaying_Page(true); NavigationService.Navigate(page); }
private void song_list_DoubleClick(object sender, MouseButtonEventArgs e) { /*var s = song_list.SelectedItem as Songs; * string path = Mp3Info.GetFilePath(s.Title, recievedAlbum,0); * (App.Current as App).nowPlaying_path = path; * nowPlaying_Page page = new nowPlaying_Page(false); * NavigationService.Navigate(page); */ List <string> paths = new List <string>(); foreach (var item in song_list.Items) { var s = item as Songs; paths.Add(Mp3Info.GetFilePath(s.Title, recievedAlbum, 0)); } if ((App.Current as App).paths != null) { (App.Current as App).paths.Clear(); } (App.Current as App).paths = paths; (App.Current as App).startIndex = song_list.SelectedIndex; nowPlaying_Page page = new nowPlaying_Page(true); NavigationService.Navigate(page); }
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(); }
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(); }
private void searchEntry_TextBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (searchEntry_TextBox.SelectedIndex >= 0) { string title = searchEntry_TextBox.SelectedItem.ToString(); string path = Mp3Info.GetFilePath(title); //(App.Current as App).paths.Clear(); (App.Current as App).paths = new List <string>(); (App.Current as App).paths.Add(path); (App.Current as App).startIndex = 0; //(App.Current as App).nowPlaying_path = path; nowPlaying_Page page = new nowPlaying_Page(true); NavigationService.Navigate(page); searchEntry_TextBox.Text = ""; } else { //searchEntry_TextBox.Items.Clear(); searchEntry_TextBox.IsDropDownOpen = false; } }