/// <summary> /// Test all methods /// </summary> public void DoTests() { int hr; IntPtr hEvent; IntPtr p1, p2; EventCode ec; BuildGraph(); hr = m_mediaEvent.GetEventHandle(out hEvent); DsError.ThrowExceptionForHR(hr); ManualResetEvent mre = new ManualResetEvent(false); mre.SafeWaitHandle = new Microsoft.Win32.SafeHandles.SafeWaitHandle(hEvent, true); // Should get an event before this bool b = mre.WaitOne(5000, true); Debug.Assert(b, "GetEventHandle"); // I don't know what event I may get, so I don't know how to check it hr = m_mediaEvent.GetEvent(out ec, out p1, out p2, 0); DsError.ThrowExceptionForHR(hr); hr = m_mediaEvent.FreeEventParams(ec, p1, p2); DsError.ThrowExceptionForHR(hr); hr = m_mediaEvent.CancelDefaultHandling(EventCode.Repaint); DsError.ThrowExceptionForHR(hr); hr = m_mediaEvent.RestoreDefaultHandling(EventCode.Repaint); DsError.ThrowExceptionForHR(hr); // The clip is 4 seconds long, so timeout in 5 hr = m_mediaEvent.WaitForCompletion(5000, out ec); DsError.ThrowExceptionForHR(hr); // The video should have successfully played Debug.Assert(ec == EventCode.Complete, "WaitForCompletion"); }