Esempio n. 1
0
        public void OnKeyPress(Key key)
        {
            if (_dvdCtrl == null || !_handlesInput || _buttonCount <= 0)
            {
                return;
            }

            if (key == Key.Up)
            {
                _dvdCtrl.SelectRelativeButton(DvdRelativeButton.Upper);
            }
            else if (key == Key.Down)
            {
                _dvdCtrl.SelectRelativeButton(DvdRelativeButton.Lower);
            }
            else if (key == Key.Left)
            {
                _dvdCtrl.SelectRelativeButton(DvdRelativeButton.Left);
            }
            else if (key == Key.Right)
            {
                _dvdCtrl.SelectRelativeButton(DvdRelativeButton.Right);
            }
            else if (_focusedButton > 0 && (key == Key.Ok || key == Key.Enter))
            {
                _dvdCtrl.ActivateButton();
            }
        }
Esempio n. 2
0
        void TestMenusAndButtons()
        {
            int       hr;
            IDvdCmd   ppCmd;
            DvdDomain dvdd;
            int       pulButtonsAvailable;
            int       pulCurrentButton;

            // Top menu
            hr = m_idc2.ShowMenu(DvdMenuId.Title, DvdCmdFlags.Flush | DvdCmdFlags.SendEvents, out ppCmd);
            DsError.ThrowExceptionForHR(hr);

            Thread.Sleep(100);
            Application.DoEvents();

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

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

            hr = m_idc2.SelectButton(2);
            DsError.ThrowExceptionForHR(hr);

            Thread.Sleep(100);
            Application.DoEvents();

            hr = m_idi2.GetCurrentButton(out pulButtonsAvailable, out pulCurrentButton);
            DsError.ThrowExceptionForHR(hr);

            Debug.Assert(pulCurrentButton == 2, "TestMenusAndButtons2");
            Debug.Assert(pulButtonsAvailable == 2, "TestMenusAndButtons2a");

            // Button 1 leads to a chapter menu with 2 items
            hr = m_idc2.SelectButton(1);
            DsError.ThrowExceptionForHR(hr);

            Thread.Sleep(100);
            Application.DoEvents();

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

            Thread.Sleep(100);

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

            Thread.Sleep(100);

            hr = m_idc2.SelectRelativeButton(DvdRelativeButton.Lower);
            DsError.ThrowExceptionForHR(hr);

            Thread.Sleep(100);

            hr = m_idi2.GetCurrentButton(out pulButtonsAvailable, out pulCurrentButton);
            DsError.ThrowExceptionForHR(hr);

            Debug.Assert(pulCurrentButton == 2, "TestMenusAndButtons2");

            hr = m_idc2.SelectAndActivateButton(1);
            DsError.ThrowExceptionForHR(hr);

            Thread.Sleep(100);

            hr = m_idc2.SelectButton(2);
            DsError.ThrowExceptionForHR(hr);

            Thread.Sleep(100);

            hr = m_idc2.SelectAtPosition(new Point(130, 130));
            DsError.ThrowExceptionForHR(hr);

            Thread.Sleep(100);

            hr = m_idi2.GetCurrentButton(out pulButtonsAvailable, out pulCurrentButton);
            DsError.ThrowExceptionForHR(hr);

            Debug.Assert(pulCurrentButton == 1, "TestMenusAndButtons2");

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

            Thread.Sleep(100);

            hr = m_idc2.ActivateAtPosition(new Point(130, 130));
            DsError.ThrowExceptionForHR(hr);

            Thread.Sleep(100);
        }