private static bool ProcessRawInput(IntPtr hRawInput) { if (RawInput != null) { RawInputEventArgs args; try { args = new RawInputEventArgs(hRawInput); } catch { #if DEBUG throw; #else return false; #endif // DEBUG } RawInput(null, args); return true; } return false; }
void RawDevice_RawInput(object sender, RawInputEventArgs e) { DeviceData dd = e.GetRawData() as DeviceData; if (dd != null) { try { byte[,] ddByte = dd.GetDataBuffer(); switch ((RawInput)ddByte[0, 1]) { case RawInput.DETAILS: break; case RawInput.GUIDE: break; case RawInput.TVJUMP: //live tv break; case RawInput.STANDBY: break; case RawInput.OEM1: break; case RawInput.OEM2: break; case RawInput.MYTV: case RawInput.RECORDEDTV: //browse to recordings ShowMediaBrowser(BrowseMode.Recordings); break; case RawInput.MYVIDEOS: //browse to videos ShowMediaBrowser(BrowseMode.Media); break; case RawInput.MYPICTURES: //browse to pictures break; case RawInput.MYMUSIC: //browse to music break; case RawInput.DVDANGLE: //ignore break; case RawInput.DVDAUDIO: //ignore break; case RawInput.DVDMENU: //navigate menu ShowDvdMenu(DvdMenuId.Root); break; case RawInput.DVDSUBTITLE: //toggle subtitles ToogleSubtitles(); break; case RawInput.INFO: //info key EPInfo ei = new EPInfo(); ei.ShowDialog(10, this); break; } } finally { if (dd != null) dd.Dispose(); } } }