示例#1
0
        private void songIdComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            // Display the selected song
            if (songIdComboBox.SelectedItem != null)
            {
                Console.WriteLine("Load song " + songIdComboBox.SelectedItem);
                int songId = Convert.ToInt32(songIdComboBox.SelectedItem);

                // Only one row should be selected
                Song song = musicLib.GetSong(songId);
                titleTextBox.Text    = song.Title;
                artistTextBox.Text   = song.Artist;
                albumTextBox.Text    = song.Album;
                genreTextBox.Text    = song.Genre;
                lengthTextBox.Text   = song.Length;
                filenameTextBox.Text = song.Filename;
            }
        }
示例#2
0
 private void songIdComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     // Display the selected song
     if (songIdComboBox.SelectedItem != null)
     {
         Console.WriteLine("Load song " + songIdComboBox.SelectedItem);
         int  songId = Convert.ToInt32(songIdComboBox.SelectedItem);
         Song song   = musicLib.GetSong(songId);
         if (song != null)
         {
             titleTextBox.Text    = song.Title.ToString();
             artistTextBox.Text   = song.Artist.ToString();
             albumTextBox.Text    = song.Album.ToString();
             genreTextBox.Text    = song.Genre.ToString();
             lengthTextBox.Text   = song.Length.ToString();
             filenameTextBox.Text = song.Filename.ToString();
         }
     }
 }
        private void songIdComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            // Display the selected song
            Console.WriteLine("Load song " + songIdComboBox.SelectedItem);
            int songId = Convert.ToInt32(songIdComboBox.SelectedItem);

            Song s = musicLib.GetSong(songId);

            if (s != null)
            {
                titleTextBox.Text    = s.Title;
                artistTextBox.Text   = s.Artist;
                albumTextBox.Text    = s.Album;
                genreTextBox.Text    = s.Genre;
                lengthTextBox.Text   = s.Length;
                filenameTextBox.Text = s.Filename;
                if (filenameTextBox.Text != "")
                {
                    mediaPlayer.Open(new Uri(filenameTextBox.Text));
                }
            }
        }