示例#1
0
        void TestPauseResume()
        {
            int                  hr;
            IDvdCmd              ppCmd;
            DvdDomain            dvdd;
            DvdPlaybackLocation2 pLocation, pLocation2;

            AllowPlay();
            hr = m_idc2.PlayChapterInTitle(1, 2, DvdCmdFlags.Flush | DvdCmdFlags.SendEvents, out ppCmd);
            DsError.ThrowExceptionForHR(hr);

            Thread.Sleep(500);

            hr = m_idc2.Pause(true);
            DsError.ThrowExceptionForHR(hr);

            Thread.Sleep(3000);

            hr = m_idi2.GetCurrentLocation(out pLocation);
            DsError.ThrowExceptionForHR(hr);

            Thread.Sleep(3000);

            hr = m_idi2.GetCurrentLocation(out pLocation2);
            DsError.ThrowExceptionForHR(hr);

            Debug.Assert(pLocation.TimeCode.bSeconds == pLocation2.TimeCode.bSeconds, "TestPauseResume");

            hr = m_idc2.Pause(false);
            DsError.ThrowExceptionForHR(hr);

            Thread.Sleep(500);

            hr = m_idi2.GetCurrentLocation(out pLocation2);
            DsError.ThrowExceptionForHR(hr);

            Debug.Assert(pLocation.TimeCode.bSeconds != pLocation2.TimeCode.bSeconds, "TestPauseResume2");

            hr = m_idc2.ShowMenu(DvdMenuId.Root, DvdCmdFlags.Flush | DvdCmdFlags.SendEvents, out ppCmd);
            DsError.ThrowExceptionForHR(hr);

            Thread.Sleep(500);

            hr = m_idi2.GetCurrentDomain(out dvdd);
            DsError.ThrowExceptionForHR(hr);

            Debug.Assert(dvdd == DvdDomain.VideoManagerMenu, "TestPauseResume3");

            hr = m_idc2.Resume(DvdCmdFlags.None, out ppCmd);
            DsError.ThrowExceptionForHR(hr);

            Thread.Sleep(500);

            hr = m_idi2.GetCurrentDomain(out dvdd);
            DsError.ThrowExceptionForHR(hr);

            Debug.Assert(dvdd == DvdDomain.Title, "TestPauseResume4");

            hr = m_idc2.StillOff();
            DsError.ThrowExceptionForHR(hr);

            hr = m_idc2.Stop();
            DsError.ThrowExceptionForHR(hr);
        }