예제 #1
0
        public void input_AppCommand(object sender, AppCommandEventArgs appCommandEventArgs)
        {
            Boolean handled = false;

            var appCommand = MapAppCommand(appCommandEventArgs.Cmd);

            _logger.Debug("input_AppCommand: {0} {1}", appCommandEventArgs.Cmd, appCommand == null ? "null" : appCommand.ToString());

            if (appCommand != null)
            {
                if (IsDuplicateMediaKeyEvent(appCommand.Value))
                {
                    _logger.Debug("input_AppCommand: IsDuplicate - cmd {0} after key {1}", appCommand, _lastKeyDown);
                    handled = true;
                }
                else
                {
                    var command = CommandMaps.MapInput(appCommand.Value);
                    handled = _defaultCommandActions.ExecuteCommand(command);
                }

                if (handled)
                {
                    _lastCmd     = appCommand.Value;
                    _lastCmdTime = DateTime.Now;
                }
                else
                {
                    _logger.Debug("input_AppCommand {0}, command not handled", appCommand);
                }
            }

            appCommandEventArgs.Handled = handled;
        }
예제 #2
0
        /// <summary>
        /// Responds to key down in application
        /// </summary>
        void input_KeyDown(object sender, WindowsInput.KeyEventArgs e)
        {
            _logger.Debug("input_KeyDown {0} Ctrl({1}) Shift({2})", e.Key, IsControlKeyDown(), IsShiftKeyDown());
            if (IsDuplicateMediaKeyEvent(e.Key))
            {
                _logger.Debug("KeyDown IsDuplicateMediaKeyEvent true:- Key {0} after cmd {1}", e.Key, _lastCmd);
            }
            else
            {
                var command = CommandMaps.MapInput(e.Key, IsControlKeyDown(), IsShiftKeyDown());
                _defaultCommandActions.ExecuteCommand(command);
            }

            _lastKeyDown     = e.Key;
            _lastKeyDownTime = DateTime.Now;
        }