示例#1
0
        private void OpenFolderBTN_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Multiselect = true;
            List <SongModel> songs = new List <SongModel>();

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                foreach (string file in openFileDialog.FileNames)
                {
                    SongModel   songViewModel = new SongModel();
                    TagLib.File tagfile       = TagLib.File.Create(file);
                    songViewModel.Path   = file;
                    songViewModel.Artist = tagfile.Tag.FirstAlbumArtist;
                    songViewModel.Album  = tagfile.Tag.Album;
                    songViewModel.Title  = tagfile.Tag.Title;
                    databaseConnection.SaveSong(songViewModel);
                }
            }
            LoadSongList();
        }
示例#2
0
        private void PlayBTN_Click(object sender, EventArgs e)
        {
            SongModel song = (SongModel)MusicList.SelectedItem;

            MP3MediaPLayer.URL = song.Path;
        }