/// <summary> /// Event handler for keys. /// </summary> /// <param name="e"></param> protected override void OnKeyDown(KeyEventArgs e) { if (_script != null) { _script.keyIsPressed = false; // Decode character, maybe. var v = KeyUtils.KeyToChar(e.KeyCode, e.Modifiers); ProcessKeys(v); if (_script.key != 0) { // Valid character. _script.keyIsPressed = true; // Notify client. _script.keyPressed(); } } }
/// <summary> /// Event handler for keys. /// </summary> /// <param name="e"></param> protected override void OnKeyUp(KeyEventArgs e) { if (_script is not null) { _script.keyIsPressed = false; // Decode character, maybe. var v = KeyUtils.KeyToChar(e.KeyCode, e.Modifiers); ProcessKeys(v); if (_script.key != 0) { // Valid character. _script.keyIsPressed = false; // Notify client. _script.keyReleased(); // Now reset keys. _script.key = (char)0; _script.keyCode = 0; } } }