我有一个在应用程序运行时创建的 WMPLib.WindowsMediaPlayer 实例。当播放器播放状态 =“已停止”时,我想隐藏一个面板。
这是我的代码:
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;
}
}
任何帮助将不胜感激。