0
我有一個WMPLib.WindowsMediaPlayer實例,我在應用程序運行時創建。當玩家playstate =「Stopped」時,我想隱藏一個面板。C#WindowsMediaPlayer不在PlayStateChange上執行更改
這是我的代碼:
private void PlayFile(String url)
{
WMPLib.WindowsMediaPlayer Player = new WMPLib.WindowsMediaPlayer();
Player.PlayStateChange += new WMPLib._WMPOCXEvents_PlayStateChangeEventHandler(Player_PlayStateChange);
Player.MediaError += new WMPLib._WMPOCXEvents_MediaErrorEventHandler(Player_MediaError);
Player.URL = url;
plSpinner.Visible = true;
Player.controls.play();
}
private void Player_PlayStateChange(int NewState)
{
if ((WMPLib.WMPPlayState)NewState == WMPLib.WMPPlayState.wmppsStopped)
{
//This never gets executed
plSpinner.Visible = false;
}
}
任何幫助將不勝感激。
這是[的Windows 7](http://social.msdn.microsoft.com/Forums/ en/vbgeneral/thread/670c6cfd-6124-47e2-93ce-d948e227f652)唯一的問題? – 2012-03-01 18:18:13
我在Windows 7上開發。尚未在任何其他Windows平臺上進行測試。你認爲它的Windows 7問題? – anonymous 2012-03-01 18:46:33
當你打電話給其他國家?音樂結束時它會變成「停止」?如果它是錯誤的,那麼Visible = true? – 2012-03-01 19:31:57