/// <summary> /// When the browser has a key press, try and map it to an action and fire the on action /// </summary> /// <param name="keyPressed">Key pressed in browser</param> void _callback_OnBrowserKeyPress(int keyPressed) { // We received a key press from browser, translate it into an MP2 key. Then we try to invoke an action inside the browserhost by sending // back a translated message var key = InputMapper.MapSpecialKey((Keys)keyPressed, false, false, false); InstanceOnKeyPressed(ref key); }
protected void OnKeyPressed(object sender, KeyEventArgs e) { Key key = InputMapper.MapSpecialKey(e); if (key != _mappedKey) { return; } e.Handled = true; e.SuppressKeyPress = true; var handler = MappedKeyPressed; if (handler != null) { handler(this, EventArgs.Empty); } }
private static void MainForm_KeyDown(object sender, KeyEventArgs e) { try { // We'll handle special keys here Key key = InputMapper.MapSpecialKey(e); if (key != Key.None && key != Key.Close) { IInputManager manager = ServiceRegistration.Get <IInputManager>(); manager.KeyPress(key); e.Handled = true; } } catch (Exception ex) { ServiceRegistration.Get <ILogger>().Error("SkinEngine MainForm: Error occured in KeyDown handler", ex); } }