protected override void KeyPress(int keycode) { if (GUIGraphicsContext.form.InvokeRequired) { InvokeButtonDelegate d = new InvokeButtonDelegate(InvokeButton); GUIGraphicsContext.form.Invoke(d, new object[] { keycode }); } else { InvokeButton(keycode); } }
/// <summary> /// Send a command to mediaportal. /// Commands are defined in an input handler xml file. /// /// A command is for example "up" or "play". /// </summary> /// <param name="command"></param> public void SendCommand(String command) { RemoteButton button; switch (command.ToLower()) { case "stop": button = RemoteButton.Stop; break; case "record": button = RemoteButton.Record; break; case "pause": button = RemoteButton.Pause; break; case "play": button = RemoteButton.Play; break; case "rewind": button = RemoteButton.Rewind; break; case "forward": button = RemoteButton.Forward; break; case "replay": button = RemoteButton.Replay; break; case "skip": button = RemoteButton.Skip; break; case "back": button = RemoteButton.Back; break; case "info": button = RemoteButton.Info; break; case "menu": button = RemoteButton.Menu; break; case "up": button = RemoteButton.Up; break; case "down": button = RemoteButton.Down; break; case "left": button = RemoteButton.Left; break; case "right": button = RemoteButton.Right; break; case "ok": button = RemoteButton.Ok; break; case "volup": button = RemoteButton.VolumeUp; break; case "voldown": button = RemoteButton.VolumeDown; break; case "volmute": button = RemoteButton.Mute; break; case "chup": button = RemoteButton.ChannelUp; break; case "chdown": button = RemoteButton.ChannelDown; break; case "dvdmenu": button = RemoteButton.DVDMenu; break; case "0": button = RemoteButton.NumPad0; break; case "1": button = RemoteButton.NumPad1; break; case "2": button = RemoteButton.NumPad2; break; case "3": button = RemoteButton.NumPad3; break; case "4": button = RemoteButton.NumPad4; break; case "5": button = RemoteButton.NumPad5; break; case "6": button = RemoteButton.NumPad6; break; case "7": button = RemoteButton.NumPad7; break; case "8": button = RemoteButton.NumPad8; break; case "9": button = RemoteButton.NumPad9; break; case "clear": button = RemoteButton.Clear; break; case "enter": button = RemoteButton.Enter; break; case "teletext": button = RemoteButton.Teletext; break; case "red": button = RemoteButton.Red; break; case "blue": button = RemoteButton.Blue; break; case "yellow": button = RemoteButton.Yellow; break; case "green": button = RemoteButton.Green; break; case "home": button = RemoteButton.Home; break; case "basichome": button = RemoteButton.BasicHome; break; case "nowplaying": button = RemoteButton.NowPlaying; break; case "tvguide": button = RemoteButton.Guide; break; case "tvrecs": button = RemoteButton.RecordedTV; break; case "dvd": button = RemoteButton.PlayDVD; break; case "playlists": button = RemoteButton.MyPlaylists; break; case "first": button = RemoteButton.First; break; case "last": button = RemoteButton.Last; break; case "fullscreen": button = RemoteButton.Fullscreen; break; case "subtitles": button = RemoteButton.Subtitles; break; case "audiotrack": button = RemoteButton.AudioTrack; break; case "screenshot": button = RemoteButton.Screenshot; break; case "aspectratio": button = RemoteButton.AspectRatio; break; case "ejectcd": button = RemoteButton.EjectCD; break; default: return; } if (GUIGraphicsContext.form.InvokeRequired) { InvokeButtonDelegate d = new InvokeButtonDelegate(InvokeButton); GUIGraphicsContext.form.Invoke(d, new object[] { button }); return; } }