the axWindowsMediaPlayer has been working correctly in my Form class, now I wanted to create an abstract factory for different players and I moved the axWindowsMediaPlayer into an implementation class of that factory. But now the playstatechanged Event isn't fired anymore, am I missing something? This is my initialization in the constructor of the implementation class:
axWindowsMediaPlayer1 = new AxWMPLib.AxWindowsMediaPlayer();
axWindowsMediaPlayer1.CreateControl();
axWindowsMediaPlayer1.BeginInit();
axWindowsMediaPlayer1.PlayStateChange += new AxWMPLib._WMPOCXEvents_PlayStateChangeEventHandler(axWindowsMediaPlayer1_PlayStateChange);
axWindowsMediaPlayer1.EndInit();
Later the event is occuring in the implementation class:
private void axWindowsMediaPlayer1_PlayStateChange(
object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
{
if (e.newState == 8)
{
this.playnext(listBox);
}
}
So am I missing something, why was this working in my Winform but not in my other class?
Now it's working, the problem was that it was a VS 2010 project. I just created a new VS 2013 project and copied the files into it, now all is working as it should.