Exemplo n.º 1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (comboAlbum.SelectedItem != null)
            {
                Album alb = (Album)comboAlbum.SelectedValue;

                List <string>  temp = new List <string>();
                OpenFileDialog of   = new OpenFileDialog();
                of.Multiselect = true;
                of.Filter      = "Music (.mp3)|*.mp3";
                if (of.ShowDialog() == true)
                {
                    foreach (string filename in of.FileNames)
                    {
                        temp.Add(filename);
                    }
                }
                iDevSong devSong = SingleDevSong.GetDev();
                foreach (string f in temp)
                {
                    var    tags     = TagLib.File.Create(f);
                    string title    = tags.Tag.Title;
                    string artist   = tags.Tag.FirstAlbumArtist;
                    string path     = f;
                    double duration = tags.Properties.Duration.TotalSeconds;
                    string genre    = tags.Tag.FirstGenre;
                    alb.Duration += duration;
                    Song s = devSong.Create(title, artist, path, duration, alb, genre);

                    Song.AddSong(s);
                }
            }
        }
Exemplo n.º 2
0
 public static iDevSong GetDev()
 {
     if (dev == null)
     {
         dev = new DevSong();
     }
     return(dev);
 }