protected override void OnKeyDown(KeyEventArgs e) { if (MacroPlaying != null) { if (e.Key == Key.Escape) { MacroPlaying.Stop(); } return; } base.OnKeyDown(e); if (e.Handled) { return; } var shiftDown = this.shiftDown; var controlDown = this.controlDown; var altDown = this.altDown; var key = e.Key; if (key == Key.System) { key = e.SystemKey; } e.Handled = HandleKey(key, shiftDown, controlDown, altDown); if ((RecordingMacro != null) && (e.Handled)) { RecordingMacro.AddKey(key, shiftDown, controlDown, altDown); } }