Example #1
0
        public static void SendMediaCenterCommand(MCCommands cmd)
        {
            switch (cmd)
            {
            case MCCommands.Play:     // Ctrl Shift P
                InputSimulator.SimulateModifiedKeyStroke(new[] { VirtualKeyCode.CONTROL, VirtualKeyCode.SHIFT }, VirtualKeyCode.VK_P);
                break;

            case MCCommands.Pause:
                InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_P);
                break;

            case MCCommands.Stop:
                InputSimulator.SimulateModifiedKeyStroke(new[] { VirtualKeyCode.CONTROL, VirtualKeyCode.SHIFT }, VirtualKeyCode.VK_S);
                break;

            case MCCommands.Ffw:
                InputSimulator.SimulateModifiedKeyStroke(new[] { VirtualKeyCode.CONTROL, VirtualKeyCode.SHIFT }, VirtualKeyCode.VK_F);
                break;

            case MCCommands.Rew:
                InputSimulator.SimulateModifiedKeyStroke(new[] { VirtualKeyCode.CONTROL, VirtualKeyCode.SHIFT }, VirtualKeyCode.VK_B);
                break;

            case MCCommands.SkipFwd:
                InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_F);
                break;

            case MCCommands.SkipBack:
                InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_B);
                break;

            case MCCommands.Record:
                InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_R);
                break;

            case MCCommands.NavUp:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.UP);
                break;

            case MCCommands.NavDown:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.DOWN);
                break;

            case MCCommands.NavLeft:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.LEFT);
                break;

            case MCCommands.NavRight:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.RIGHT);
                break;

            case MCCommands.NavBack:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.BACK);
                break;

            case MCCommands.Menu:
                InputSimulator.SimulateKeyDown(VirtualKeyCode.LWIN);
                InputSimulator.SimulateKeyDown(VirtualKeyCode.MENU);
                InputSimulator.SimulateKeyPress(VirtualKeyCode.RETURN);
                InputSimulator.SimulateKeyUp(VirtualKeyCode.MENU);
                InputSimulator.SimulateKeyUp(VirtualKeyCode.LWIN);
                break;

            case MCCommands.Info:
                InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_D);
                break;

            case MCCommands.DVDMenu:
                InputSimulator.SimulateModifiedKeyStroke(new[] { VirtualKeyCode.CONTROL, VirtualKeyCode.SHIFT }, VirtualKeyCode.VK_M);
                break;

            case MCCommands.DVDAudio:
                InputSimulator.SimulateModifiedKeyStroke(new[] { VirtualKeyCode.CONTROL, VirtualKeyCode.SHIFT }, VirtualKeyCode.VK_A);
                break;

            case MCCommands.OK:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.RETURN);
                break;

            case MCCommands.Clear:

                break;

            case MCCommands.Enter:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.RETURN);
                break;

            case MCCommands.VolUp:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VOLUME_UP);
                break;

            case MCCommands.VolDown:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VOLUME_DOWN);
                break;

            case MCCommands.VolMute:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VOLUME_MUTE);
                break;

            case MCCommands.ChanUp:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.PRIOR);
                break;

            case MCCommands.ChanDown:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.NEXT);
                break;

            case MCCommands.Num0:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_9);
                break;

            case MCCommands.Num1:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_9);
                break;

            case MCCommands.Num2:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_9);
                break;

            case MCCommands.Num3:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_9);
                break;

            case MCCommands.Num4:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_9);
                break;

            case MCCommands.Num5:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_9);
                break;

            case MCCommands.Num6:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_9);
                break;

            case MCCommands.Num7:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_9);
                break;

            case MCCommands.Num8:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_9);
                break;

            case MCCommands.Num9:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_9);
                break;

            case MCCommands.NumHash:
                InputSimulator.SimulateTextEntry("#");
                break;

            case MCCommands.NumStar:
                InputSimulator.SimulateKeyPress(VirtualKeyCode.MULTIPLY);
                break;

            case MCCommands.Text:

                break;

            case MCCommands.TextRed:

                break;

            case MCCommands.TextGreen:

                break;

            case MCCommands.TextYellow:

                break;

            case MCCommands.TextBlue:

                break;

            case MCCommands.Subtitles:
                InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_U);
                break;

            case MCCommands.GotoLiveTV:
                InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_T);
                break;

            case MCCommands.GotoGuide:
                InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_G);
                break;

            case MCCommands.GotoRecTV:
                InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_O);
                break;

            case MCCommands.GotoPictures:
                InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_I);
                break;

            case MCCommands.GotoVideos:
                InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_E);
                break;

            case MCCommands.GotoMusic:
                InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_M);
                break;

            case MCCommands.GotoMovies:
                InputSimulator.SimulateModifiedKeyStroke(new [] { VirtualKeyCode.CONTROL, VirtualKeyCode.SHIFT }, VirtualKeyCode.VK_M);
                break;

            case MCCommands.GotoRadio:
                InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_A);
                break;


            case MCCommands.GotoExtras:
                InputSimulator.SimulateModifiedKeyStroke(new[] { VirtualKeyCode.CONTROL, VirtualKeyCode.SHIFT }, VirtualKeyCode.VK_R);
                break;

            case MCCommands.GreenButton:
                InputSimulator.SimulateKeyDown(VirtualKeyCode.LWIN);
                InputSimulator.SimulateKeyDown(VirtualKeyCode.MENU);
                InputSimulator.SimulateKeyPress(VirtualKeyCode.RETURN);
                InputSimulator.SimulateKeyUp(VirtualKeyCode.MENU);
                InputSimulator.SimulateKeyUp(VirtualKeyCode.LWIN);
                break;

            case MCCommands.Power:
                if (File.Exists(MEDIA_CENTER_PATH))
                {
                    System.Diagnostics.Process.Start(MEDIA_CENTER_PATH);
                }

                /*
                 *             SendKeyDown(VK.VK_MENU);
                 * SendKeyStroke(VK.VK_F4);
                 * SendKeyUp(VK.VK_MENU);
                 */
                break;
            }
        }
Example #2
0
        public static void SendMediaCenterCommand(MCCommands cmd)
        {
            switch (cmd)
            {
                case MCCommands.Play: // Ctrl Shift P
                    SendKeyStroke("P", true, true);
                    break;

                case MCCommands.Pause:
                    SendKeyStroke("P", true);
                    break;

                case MCCommands.Stop:
                    SendKeyDown(VK.VK_CONTROL);
                    SendKeyDown(VK.VK_SHIFT);
                    SendKeyStroke(VK.VK_LETTER_S);
                    SendKeyUp(VK.VK_SHIFT);
                    SendKeyUp(VK.VK_CONTROL);
                    break;

                case MCCommands.Ffw:
                    SendKeyDown(VK.VK_CONTROL);
                    SendKeyDown(VK.VK_SHIFT);
                    SendKeyStroke(VK.VK_LETTER_F);
                    SendKeyUp(VK.VK_SHIFT);
                    SendKeyUp(VK.VK_CONTROL);
                    break;

                case MCCommands.Rew:
                    SendKeyDown(VK.VK_CONTROL);
                    SendKeyDown(VK.VK_SHIFT);
                    SendKeyStroke(VK.VK_LETTER_R);
                    SendKeyUp(VK.VK_SHIFT);
                    SendKeyUp(VK.VK_CONTROL);
                    break;

                case MCCommands.SkipFwd:
                    SendKeyDown(VK.VK_CONTROL);
                    SendKeyStroke(VK.VK_LETTER_F);
                    SendKeyUp(VK.VK_CONTROL);
                    break;

                case MCCommands.SkipBack:
                    SendKeyDown(VK.VK_CONTROL);
                    SendKeyStroke(VK.VK_LETTER_B);
                    SendKeyUp(VK.VK_CONTROL);
                    break;

                case MCCommands.Record:
                    SendKeyDown(VK.VK_CONTROL);
                    SendKeyStroke(VK.VK_LETTER_R);
                    SendKeyUp(VK.VK_CONTROL);
                    break;

                case MCCommands.NavUp:
                    SendKeyStroke("{UP}");
                    break;

                case MCCommands.NavDown:
                    SendKeyStroke("{DOWN}");
                    break;

                case MCCommands.NavLeft:
                    SendKeyStroke("{LEFT}");
                    break;

                case MCCommands.NavRight:
                    SendKeyStroke("{RIGHT}");
                    break;

                case MCCommands.NavBack:
                    SendKeyStroke(VK.VK_BACK);
                    break;

                case MCCommands.Menu:

                    SendKeyStroke("({ESC}{ENTER})", true, false, true);
                    break;

                case MCCommands.Info:
                    SendKeyDown(VK.VK_CONTROL);
                    SendKeyStroke(VK.VK_LETTER_D);
                    SendKeyUp(VK.VK_CONTROL);
                    break;

                case MCCommands.DVDMenu:
                    SendKeyDown(VK.VK_CONTROL);
                    SendKeyDown(VK.VK_SHIFT);
                    SendKeyStroke(VK.VK_LETTER_M);
                    SendKeyUp(VK.VK_SHIFT);
                    SendKeyUp(VK.VK_CONTROL);
                    break;

                case MCCommands.OK:
                    SendKeyStroke(VK.VK_RETURN);
                    break;

                case MCCommands.Clear:

                    break;

                case MCCommands.Enter:
                    SendKeyStroke(VK.VK_RETURN);
                    break;

                case MCCommands.VolUp:
                    SendKeyStroke(VK.VK_VOLUME_UP);
                    break;

                case MCCommands.VolDown:
                    SendKeyStroke(VK.VK_VOLUME_DOWN);
                    break;

                case MCCommands.VolMute:
                    SendKeyStroke(VK.VK_VOLUME_MUTE);
                    break;

                case MCCommands.ChanUp:
                    SendKeyStroke(VK.VK_PRIOR);
                    break;

                case MCCommands.ChanDown:
                    SendKeyStroke(VK.VK_NEXT);
                    break;

                case MCCommands.Num0:
                    SendKeyStroke(VK.VK_NUMPAD0);
                    break;

                case MCCommands.Num1:
                    SendKeyStroke(VK.VK_NUMPAD1);
                    break;

                case MCCommands.Num2:
                    SendKeyStroke(VK.VK_NUMPAD2);
                    break;

                case MCCommands.Num3:
                    SendKeyStroke(VK.VK_NUMPAD3);
                    break;

                case MCCommands.Num4:
                    SendKeyStroke(VK.VK_NUMPAD4);
                    break;

                case MCCommands.Num5:
                    SendKeyStroke(VK.VK_NUMPAD5);
                    break;

                case MCCommands.Num6:
                    SendKeyStroke(VK.VK_NUMPAD6);
                    break;

                case MCCommands.Num7:
                    SendKeyStroke(VK.VK_NUMPAD7);
                    break;

                case MCCommands.Num8:
                    SendKeyStroke(VK.VK_NUMPAD8);
                    break;

                case MCCommands.Num9:
                    SendKeyStroke(VK.VK_NUMPAD9);
                    break;

                case MCCommands.NumHash:

                    break;

                case MCCommands.NumStar:
                    SendKeyStroke(VK.VK_MULTIPLY);
                    break;

                case MCCommands.Text:

                    break;

                case MCCommands.TextRed:

                    break;

                case MCCommands.TextGreen:

                    break;

                case MCCommands.TextYellow:

                    break;

                case MCCommands.TextBlue:

                    break;

                case MCCommands.Subtitles:
                    SendKeyDown(VK.VK_CONTROL);
                    SendKeyStroke(VK.VK_LETTER_U);
                    SendKeyUp(VK.VK_CONTROL);
                    break;

                case MCCommands.GotoLiveTV:
                    SendKeyDown(VK.VK_CONTROL);
                    SendKeyStroke(VK.VK_LETTER_T);
                    SendKeyUp(VK.VK_CONTROL);
                    break;

                case MCCommands.GotoGuide:
                    SendKeyDown(VK.VK_CONTROL);
                    SendKeyStroke(VK.VK_LETTER_G);
                    SendKeyUp(VK.VK_CONTROL);
                    break;

                case MCCommands.GotoRecTV:
                    SendKeyDown(VK.VK_CONTROL);
                    SendKeyStroke(VK.VK_LETTER_O);
                    SendKeyUp(VK.VK_CONTROL);
                    break;

                case MCCommands.GotoPictures:
                    SendKeyDown(VK.VK_CONTROL);
                    SendKeyStroke(VK.VK_LETTER_I);
                    SendKeyUp(VK.VK_CONTROL);
                    break;

                case MCCommands.GotoVideos:
                    SendKeyStroke("E", true);
                    break;

                case MCCommands.GotoMusic:
                    SendKeyStroke("M", true);
                    break;

                case MCCommands.GotoMovies:
                    SendKeyDown(VK.VK_CONTROL);
                    SendKeyDown(VK.VK_SHIFT);
                    SendKeyStroke(VK.VK_LETTER_M);
                    SendKeyUp(VK.VK_SHIFT);
                    SendKeyUp(VK.VK_CONTROL);
                    break;

                case MCCommands.GotoRadio:
                    SendKeyDown(VK.VK_CONTROL);
                    SendKeyStroke(VK.VK_LETTER_A);
                    SendKeyUp(VK.VK_CONTROL);
                    break;

                case MCCommands.GreenButton:
                    SendKeyDown(VK.VK_LWIN);
                    SendKeyDown(VK.VK_MENU);
                    SendKeyStroke(VK.VK_RETURN);
                    SendKeyUp(VK.VK_LWIN);
                    SendKeyUp(VK.VK_MENU);
                    break;

                case MCCommands.Power:
                    if (File.Exists(MEDIA_CENTER_PATH))
                    {
                        System.Diagnostics.Process.Start(MEDIA_CENTER_PATH);
                    }
                    /*
                     *             SendKeyDown(VK.VK_MENU);
            SendKeyStroke(VK.VK_F4);
            SendKeyUp(VK.VK_MENU);
                     */
                    break;
            }
        }
Example #3
0
        public static void SendMediaCenterCommand(MCCommands cmd)
        {
            switch (cmd)
            {
            case MCCommands.Play:     // Ctrl Shift P
                SendKeyDown(VK.VK_CONTROL);
                SendKeyDown(VK.VK_SHIFT);
                SendKeyStroke(VK.VK_LETTER_P);
                SendKeyUp(VK.VK_SHIFT);
                SendKeyUp(VK.VK_CONTROL);
                break;

            case MCCommands.Pause:
                SendKeyDown(VK.VK_CONTROL);
                SendKeyStroke(VK.VK_LETTER_P);
                SendKeyUp(VK.VK_CONTROL);
                break;

            case  MCCommands.Stop:
                SendKeyDown(VK.VK_CONTROL);
                SendKeyDown(VK.VK_SHIFT);
                SendKeyStroke(VK.VK_LETTER_S);
                SendKeyUp(VK.VK_SHIFT);
                SendKeyUp(VK.VK_CONTROL);
                break;

            case  MCCommands.Ffw:
                SendKeyDown(VK.VK_CONTROL);
                SendKeyDown(VK.VK_SHIFT);
                SendKeyStroke(VK.VK_LETTER_F);
                SendKeyUp(VK.VK_SHIFT);
                SendKeyUp(VK.VK_CONTROL);
                break;

            case  MCCommands.Rew:
                SendKeyDown(VK.VK_CONTROL);
                SendKeyDown(VK.VK_SHIFT);
                SendKeyStroke(VK.VK_LETTER_R);
                SendKeyUp(VK.VK_SHIFT);
                SendKeyUp(VK.VK_CONTROL);
                break;

            case  MCCommands.SkipFwd:
                SendKeyDown(VK.VK_CONTROL);
                SendKeyStroke(VK.VK_LETTER_F);
                SendKeyUp(VK.VK_CONTROL);
                break;

            case  MCCommands.SkipBack:
                SendKeyDown(VK.VK_CONTROL);
                SendKeyStroke(VK.VK_LETTER_B);
                SendKeyUp(VK.VK_CONTROL);
                break;

            case  MCCommands.Record:
                SendKeyDown(VK.VK_CONTROL);
                SendKeyStroke(VK.VK_LETTER_R);
                SendKeyUp(VK.VK_CONTROL);
                break;

            case  MCCommands.NavUp:
                SendKeyStroke(VK.VK_UP);
                break;

            case  MCCommands.NavDown:
                SendKeyStroke(VK.VK_DOWN);
                break;

            case  MCCommands.NavLeft:
                SendKeyStroke(VK.VK_LEFT);
                break;

            case  MCCommands.NavRight:
                SendKeyStroke(VK.VK_RIGHT);
                break;

            case  MCCommands.NavBack:
                SendKeyStroke(VK.VK_BACK);
                break;

            case  MCCommands.Menu:
                SendKeyDown(VK.VK_LWIN);
                SendKeyDown(VK.VK_MENU);
                SendKeyStroke(VK.VK_RETURN);
                SendKeyUp(VK.VK_LWIN);
                SendKeyUp(VK.VK_MENU);
                break;

            case  MCCommands.Info:
                SendKeyDown(VK.VK_CONTROL);
                SendKeyStroke(VK.VK_LETTER_D);
                SendKeyUp(VK.VK_CONTROL);
                break;

            case  MCCommands.DVDMenu:
                SendKeyDown(VK.VK_CONTROL);
                SendKeyDown(VK.VK_SHIFT);
                SendKeyStroke(VK.VK_LETTER_M);
                SendKeyUp(VK.VK_SHIFT);
                SendKeyUp(VK.VK_CONTROL);
                break;

            case  MCCommands.OK:
                SendKeyStroke(VK.VK_RETURN);
                break;

            case  MCCommands.Clear:

                break;

            case  MCCommands.Enter:
                SendKeyStroke(VK.VK_RETURN);
                break;

            case  MCCommands.VolUp:
                SendKeyStroke(VK.VK_VOLUME_UP);
                break;

            case  MCCommands.VolDown:
                SendKeyStroke(VK.VK_VOLUME_DOWN);
                break;

            case  MCCommands.VolMute:
                SendKeyStroke(VK.VK_VOLUME_MUTE);
                break;

            case  MCCommands.ChanUp:
                SendKeyStroke(VK.VK_PRIOR);
                break;

            case  MCCommands.ChanDown:
                SendKeyStroke(VK.VK_NEXT);
                break;

            case  MCCommands.Num0:
                SendKeyStroke(VK.VK_NUMPAD0);
                break;

            case  MCCommands.Num1:
                SendKeyStroke(VK.VK_NUMPAD1);
                break;

            case  MCCommands.Num2:
                SendKeyStroke(VK.VK_NUMPAD2);
                break;

            case  MCCommands.Num3:
                SendKeyStroke(VK.VK_NUMPAD3);
                break;

            case  MCCommands.Num4:
                SendKeyStroke(VK.VK_NUMPAD4);
                break;

            case  MCCommands.Num5:
                SendKeyStroke(VK.VK_NUMPAD5);
                break;

            case  MCCommands.Num6:
                SendKeyStroke(VK.VK_NUMPAD6);
                break;

            case  MCCommands.Num7:
                SendKeyStroke(VK.VK_NUMPAD7);
                break;

            case  MCCommands.Num8:
                SendKeyStroke(VK.VK_NUMPAD8);
                break;

            case  MCCommands.Num9:
                SendKeyStroke(VK.VK_NUMPAD9);
                break;

            case  MCCommands.NumHash:

                break;

            case  MCCommands.NumStar:
                SendKeyStroke(VK.VK_MULTIPLY);
                break;

            case  MCCommands.Text:

                break;

            case  MCCommands.TextRed:

                break;

            case  MCCommands.TextGreen:

                break;

            case  MCCommands.TextYellow:

                break;

            case  MCCommands.TextBlue:

                break;

            case  MCCommands.Subtitles:
                SendKeyDown(VK.VK_CONTROL);
                SendKeyStroke(VK.VK_LETTER_U);
                SendKeyUp(VK.VK_CONTROL);
                break;

            case  MCCommands.GotoLiveTV:
                SendKeyDown(VK.VK_CONTROL);
                SendKeyStroke(VK.VK_LETTER_T);
                SendKeyUp(VK.VK_CONTROL);
                break;

            case MCCommands.GotoGuide:
                SendKeyDown(VK.VK_CONTROL);
                SendKeyStroke(VK.VK_LETTER_G);
                SendKeyUp(VK.VK_CONTROL);
                break;

            case  MCCommands.GotoRecTV:
                SendKeyDown(VK.VK_CONTROL);
                SendKeyStroke(VK.VK_LETTER_O);
                SendKeyUp(VK.VK_CONTROL);
                break;

            case  MCCommands.GotoPictures:
                SendKeyDown(VK.VK_CONTROL);
                SendKeyStroke(VK.VK_LETTER_I);
                SendKeyUp(VK.VK_CONTROL);
                break;

            case MCCommands.GotoVideos:
                SendKeyDown(VK.VK_CONTROL);
                SendKeyStroke(VK.VK_LETTER_E);
                SendKeyUp(VK.VK_CONTROL);
                break;

            case  MCCommands.GotoMusic:
                SendKeyDown(VK.VK_CONTROL);
                SendKeyStroke(VK.VK_LETTER_M);
                SendKeyUp(VK.VK_CONTROL);
                break;

            case  MCCommands.GotoMovies:
                SendKeyDown(VK.VK_CONTROL);
                SendKeyDown(VK.VK_SHIFT);
                SendKeyStroke(VK.VK_LETTER_M);
                SendKeyUp(VK.VK_SHIFT);
                SendKeyUp(VK.VK_CONTROL);
                break;

            case  MCCommands.GotoRadio:
                SendKeyDown(VK.VK_CONTROL);
                SendKeyStroke(VK.VK_LETTER_A);
                SendKeyUp(VK.VK_CONTROL);
                break;

            case  MCCommands.GreenButton:
                SendKeyDown(VK.VK_LWIN);
                SendKeyDown(VK.VK_MENU);
                SendKeyStroke(VK.VK_RETURN);
                SendKeyUp(VK.VK_LWIN);
                SendKeyUp(VK.VK_MENU);
                break;

            case  MCCommands.Power:
                if (File.Exists(MEDIA_CENTER_PATH))
                {
                    System.Diagnostics.Process.Start(MEDIA_CENTER_PATH);
                }

                /*
                 *             SendKeyDown(VK.VK_MENU);
                 * SendKeyStroke(VK.VK_F4);
                 * SendKeyUp(VK.VK_MENU);
                 */
                break;
            }
        }
Example #4
0
        static void SendMediaCenterCommand(MCCommands cmd)
        {
            switch (cmd)
            {
                case MCCommands.Play: // Ctrl Shift P
                    InputSimulator.SimulateModifiedKeyStroke(new[] { VirtualKeyCode.CONTROL, VirtualKeyCode.SHIFT }, VirtualKeyCode.VK_P);
                    break;

                case MCCommands.Pause:
                    InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_P);
                    break;

                case MCCommands.Stop:
                    InputSimulator.SimulateModifiedKeyStroke(new[] { VirtualKeyCode.CONTROL, VirtualKeyCode.SHIFT }, VirtualKeyCode.VK_S);
                    break;

                case MCCommands.Ffw:
                    InputSimulator.SimulateModifiedKeyStroke(new[] { VirtualKeyCode.CONTROL, VirtualKeyCode.SHIFT }, VirtualKeyCode.VK_F);
                    break;

                case MCCommands.Rew:
                    InputSimulator.SimulateModifiedKeyStroke(new[] { VirtualKeyCode.CONTROL, VirtualKeyCode.SHIFT }, VirtualKeyCode.VK_B);
                    break;

                case MCCommands.SkipFwd:
                    InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_F);
                    break;

                case MCCommands.SkipBack:
                    InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_B);
                    break;

                case MCCommands.Record:
                    InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_R);
                    break;

                case MCCommands.NavUp:
                    InputSimulator.SimulateKeyPress(VirtualKeyCode.UP);
                    break;

                case MCCommands.NavDown:
                    InputSimulator.SimulateKeyPress(VirtualKeyCode.DOWN);
                    break;

                case MCCommands.NavLeft:
                    InputSimulator.SimulateKeyPress(VirtualKeyCode.LEFT);
                    break;

                case MCCommands.NavRight:
                    InputSimulator.SimulateKeyPress(VirtualKeyCode.RIGHT);
                    break;

                case MCCommands.NavBack:
                    InputSimulator.SimulateKeyPress(VirtualKeyCode.BACK);
                    break;

                case MCCommands.Menu:
                    InputSimulator.SimulateKeyDown(VirtualKeyCode.LWIN);
                    InputSimulator.SimulateKeyDown(VirtualKeyCode.MENU);
                    InputSimulator.SimulateKeyPress(VirtualKeyCode.RETURN);
                    InputSimulator.SimulateKeyUp(VirtualKeyCode.MENU);
                    InputSimulator.SimulateKeyUp(VirtualKeyCode.LWIN);
                    break;

                case MCCommands.Info:
                    InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_D);
                    break;

                case MCCommands.DVDMenu:
                    InputSimulator.SimulateModifiedKeyStroke(new[] { VirtualKeyCode.CONTROL, VirtualKeyCode.SHIFT}, VirtualKeyCode.VK_M);
                    break;

                case MCCommands.DVDAudio:
                    InputSimulator.SimulateModifiedKeyStroke(new[] { VirtualKeyCode.CONTROL, VirtualKeyCode.SHIFT }, VirtualKeyCode.VK_A);
                    break;

                case MCCommands.OK:
                    InputSimulator.SimulateKeyPress(VirtualKeyCode.RETURN);
                    break;

                case MCCommands.Clear:

                    break;

                case MCCommands.Enter:
                    InputSimulator.SimulateKeyPress(VirtualKeyCode.RETURN);
                    break;

                case MCCommands.VolUp:
                    InputSimulator.SimulateKeyPress(VirtualKeyCode.VOLUME_UP);
                    break;

                case MCCommands.VolDown:
                    InputSimulator.SimulateKeyPress(VirtualKeyCode.VOLUME_DOWN);
                    break;

                case MCCommands.VolMute:
                    InputSimulator.SimulateKeyPress(VirtualKeyCode.VOLUME_MUTE);
                    break;

                case MCCommands.ChanUp:
                    InputSimulator.SimulateKeyPress(VirtualKeyCode.PRIOR);
                    break;

                case MCCommands.ChanDown:
                    InputSimulator.SimulateKeyPress(VirtualKeyCode.NEXT);
                    break;

                case MCCommands.Num0:
                    InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_0);
                    break;

                case MCCommands.Num1:
                    InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_1);
                    break;

                case MCCommands.Num2:
                    InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_2);
                    break;

                case MCCommands.Num3:
                    InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_3);
                    break;

                case MCCommands.Num4:
                    InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_4);
                    break;

                case MCCommands.Num5:
                    InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_5);
                    break;

                case MCCommands.Num6:
                    InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_6);
                    break;

                case MCCommands.Num7:
                    InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_7);
                    break;

                case MCCommands.Num8:
                    InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_8);
                    break;

                case MCCommands.Num9:
                    InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_9);
                    break;

                case MCCommands.NumHash:
                    InputSimulator.SimulateTextEntry("#");
                    break;

                case MCCommands.NumStar:
                    InputSimulator.SimulateKeyPress(VirtualKeyCode.MULTIPLY);
                    break;

                case MCCommands.Text:

                    break;

                case MCCommands.TextRed:

                    break;

                case MCCommands.TextGreen:

                    break;

                case MCCommands.TextYellow:

                    break;

                case MCCommands.TextBlue:

                    break;

                case MCCommands.Subtitles:
                    InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_U);
                    break;

                case MCCommands.GotoLiveTV:
                    InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_T);
                    break;

                case MCCommands.GotoGuide:
                    InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_G);
                    break;

                case MCCommands.GotoRecTV:
                    InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_O);
                    break;

                case MCCommands.GotoPictures:
                    InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_I);
                    break;

                case MCCommands.GotoVideos:
                    InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_E);
                    break;

                case MCCommands.GotoMusic:
                    InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_M);
                    break;

                case MCCommands.GotoMovies:
                    InputSimulator.SimulateModifiedKeyStroke(new [] {VirtualKeyCode.CONTROL, VirtualKeyCode.SHIFT}, VirtualKeyCode.VK_M);
                    break;

                case MCCommands.GotoRadio:
                    InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_A);
                    break;

                case MCCommands.GotoExtras:
                    InputSimulator.SimulateModifiedKeyStroke(new[] { VirtualKeyCode.CONTROL, VirtualKeyCode.SHIFT }, VirtualKeyCode.VK_R);
                    break;

                case MCCommands.GreenButton:
                    InputSimulator.SimulateKeyDown(VirtualKeyCode.LWIN);
                    InputSimulator.SimulateKeyDown(VirtualKeyCode.MENU);
                    InputSimulator.SimulateKeyPress(VirtualKeyCode.RETURN);
                    InputSimulator.SimulateKeyUp(VirtualKeyCode.MENU);
                    InputSimulator.SimulateKeyUp(VirtualKeyCode.LWIN);
                    break;

                case MCCommands.Power:
                    if (File.Exists(MEDIA_CENTER_PATH))
                        System.Diagnostics.Process.Start(MEDIA_CENTER_PATH);
                    /*
                     *             SendKeyDown(VK.VK_MENU);
            SendKeyStroke(VK.VK_F4);
            SendKeyUp(VK.VK_MENU);
                     */
                    break;
            }
        }