0
我正在建立一個音樂播放器,所以我選擇使用Window Media Player的庫:現在我被卡住了,因爲我想在列表框中顯示歌曲的名稱並實時更改歌曲,但我不知道如何去做。我存儲來自文件夾的歌曲,所以當音樂播放器播放來自Url的歌曲時。我該如何更改c#中windows media player的默認語言設置?
代碼片段:
private void PlaylistMidday(String folder, string extendsion)
{
string myPlaylist = "D:\\Music\\The_Chemical_Brothers-Do_It_Again-(US_CDM)-2007-SAW\\";
ListView musicList = new ListView();
WMPLib.IWMPPlaylist pl;
WMPLib.IWMPPlaylistArray plItems;
plItems = player1.playlistCollection.getByName(myPlaylist);
if (plItems.count == 0)
pl = player1.playlistCollection.newPlaylist(myPlaylist);
else
pl = plItems.Item(0);
DirectoryInfo dir = new DirectoryInfo(folder);
FileInfo[] files = dir.GetFiles(extendsion, SearchOption.AllDirectories);
foreach (FileInfo file in files)
{
string musicFile01 = file.FullName;
string mName = file.Name;
ListViewItem item = new ListViewItem(mName);
musicList.Items.Add(item);
WMPLib.IWMPMedia m1 = player1.newMedia(musicFile01);
pl.appendItem(m1);
}
player1.currentPlaylist = pl;
player1.Ctlcontrols.play();
}
有載我決定玩「myPLaylist」的歌曲,所以我問你,你知道一些方法如何表達我的播放列表中的歌曲列表框,當我點擊選擇的項目,歌曲將會改變?