예제 #1
0
 public void delSong(Song song, bool fromComputer)
 {
     for (int i = 0; i < library.songs.Count(); i++)
     {
         if (song.path == library.songs[i].path)
         {
             library.songs.RemoveAt(i);
             if (fromComputer == true && File.Exists(song.title))
                 File.Delete(song.path);
         }
     }
     saveLib(library);
 }
 private bool compare_songs_by_order(string order, Song first, Song second)
 {
     if (order == "Title")
         return (first.title.CompareTo(second.title) > 0);
     else if (order == "Album")
         return (first.album.CompareTo(second.album) > 0);
     else
         return (first.artist[0].CompareTo(second.artist[0]) > 0);
 }
        private void listView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            mediaElement.Stop();
            isPlaying = false;

            if (statut == false && listView.SelectedItem != null)
            {
                Media url = (Media)listView.SelectedItem;
                try
                {
                    mediaElement.Source = new Uri(url.path);
                }
                catch
                {
                    Console.WriteLine("Error mediaElement");
                }
            }
            else if (statut == true && listView.SelectedItem != null)
            {
                Song url;
                try
                {
                    url = (Song)listView.SelectedItem;
                }
                catch
                {
                    listView.Items.Clear();
                    url = new Song();
                }
                if (url.path != null)
                {
                    try
                    {
                        mediaElement.Source = new Uri(url.path);
                    }
                    catch
                    {
                        Console.WriteLine("Error mediaElement");
                    }
                }
            }
        }
예제 #4
0
 public void addSongInfo(string path)
 {
     TagLib.File file = TagLib.File.Create(path);
     Song song = new Song( file.Tag.Title, file.Tag.Performers.ToList<string>(), file.Tag.Album, path, file.Tag.TrackCount);
     library.songs.Add(song);
 }
예제 #5
0
 public void addSong(Song song)
 {
     songs.Add(song);
 }