public MainWindow() { InitializeComponent(); musicLib = new MusicLib(); mediaPlayer = new MediaPlayer(); //load playlist list playlistListBox.Items.Add("All Music"); foreach (var playlist in musicLib.Playlists) { playlistListBox.Items.Add(playlist); } //load songs displayedSongs = new List <Song>(); dataGrid.ItemsSource = displayedSongs; foreach (var songId in musicLib.SongIds) { var song = musicLib.GetSong(int.Parse(songId)); displayedSongs.Add(song); } //disable sorting foreach (DataGridColumn column in dataGrid.Columns) { column.CanUserSort = false; } }
public MainWindow() { InitializeComponent(); musicPlayer = new MediaPlayer(); try { musicLibrary = new MusicLib(); } catch(Exception e) { MessageBox.Show("Songs could not be uploaded."); } musicLibrary.AddPlaylist("All Music"); foreach (string s in musicLibrary.SongIds) { musicLibrary.AddSongToPlaylist(Int32.Parse(s), "All Music"); } playlistListBox.ItemsSource = musicLibrary.Playlists; musicDataGrid.ItemsSource = musicLibrary.Songs.DefaultView; }
public MainWindow() { InitializeComponent(); musicLib = new MusicLib(); UpdateList(); UpdateGrid(); mediaPlayer = new MediaPlayer(); }
public MainWindow() { InitializeComponent(); stopButton.IsEnabled = false; mediaPlayer = new MediaPlayer(); try { musicLib = new MusicLib(); } catch (Exception e) { MessageBox.Show("There was a problem: " + e.Message); } dataGrid.ItemsSource = musicLib.MusicDataSet.Tables["song"].DefaultView; playlistBox.ItemsSource = musicLib.Playlists; }