コード例 #1
0
 public bool ExecuteCommand(Command command, Object args)
 {
     _logger.Debug("ExecuteCommand {0} {1}", command, args);
     var commandEventArgs = new CommandEventArgs { Command = command, Args = args, Handled = false };
     _commandReceived.Invoke(null, commandEventArgs);
     return commandEventArgs.Handled;
 }
コード例 #2
0
 private void commandManager_CommandReceived(object sender, CommandEventArgs commandEventArgs)
 {
     _logger.Debug("commandManager_CommandReceived {0} {1}", commandEventArgs.Command, commandEventArgs.Args);
     commandEventArgs.Handled = _defaultCommandActionMap.ExecuteCommand(commandEventArgs.Command, commandEventArgs.Args);
 }
コード例 #3
0
        public void input_AppCommand(object sender, AppCommandEventArgs appCommandEventArgs)
        {
            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);
                    appCommandEventArgs.Handled = false;
                }
                else
                {
                    if (_commandReceived != null)
                    { 
                        var command = _inputCommandMaps.GetMappedCommand(appCommand.Value);
                        var commandEventArgs = new CommandEventArgs { Command = command, Handled = appCommandEventArgs.Handled};
                        _commandReceived.Invoke(null, commandEventArgs);
                        appCommandEventArgs.Handled = commandEventArgs.Handled;
                    }
                }

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