/** * Helper that implements the common pattern of pressing a KeyPress which may be null * and then returning an action to release that key. */ public static Action CallbackPress(IKeyPress keyPress) { if (keyPress == null) { return () => { } } ; keyPress.Press(); return(() => keyPress.Release()); }