예제 #1
0
 private void MP3_Listbox_SelectionChanged(object sender, RoutedEventArgs e)
 {
     try
     {
         if (!Edit && MP3)
         {
             currentMP3                 = (MP3)MP3_Listbox.SelectedItem;
             maxTimeLabel.Content       = currentMP3.Duration.ToString().Split(':')[1] + ":" + currentMP3.Duration.ToString().Split(':')[2].Split('.')[0];
             DisplayArtistLabel.Content = currentMP3.Artist;
             DisplayTitleLabel.Content  = currentMP3.Title;
             int index = currentMP3.MP3_ID;
             SQLHandler.selectQuery("SELECT location FROM MP3 WHERE MP3_id='" + index + "'");
             if (SQLHandler.read.HasRows)
             {
                 while (SQLHandler.read.Read())
                 {
                     player.Open(new Uri(SQLHandler.read[0].ToString()));
                     player.Play();
                     playing = true;
                 }
             }
         }
         else if (Edit)
         {
             MP3 song = (MP3)MP3_Listbox.SelectedItem;
             MessageBox.Show(song.ToString());
             Edit_MP3 next = new Edit_MP3();
             next.ID = song;
             next.ShowDialog();
         }
         else
         {
             MP3 = true;
         }
     }
     catch (Exception)
     { }
 }
예제 #2
0
 private void New_Playlist_Click(object sender, RoutedEventArgs e)
 {
     SQLHandler.selectQuery("INSERT INTO Playlist (name) VALUES ('" + PlaylistNameTextBox.Text + "')");
 }