private void RemoteEvent(IrProtocol codeType, uint keyCode, bool firstPress)
    {
#if TRACE
      Trace.WriteLine(String.Format("Remote: {0}, {1}, {2}", Enum.GetName(typeof(IrProtocol), codeType), keyCode, firstPress));
#endif

      if (!firstPress && _lastRemoteButtonCodeType == codeType && _lastRemoteButtonKeyCode == keyCode)
      {
        TimeSpan timeBetween = DateTime.Now.Subtract(_lastRemoteButtonTime);

        if (!_remoteButtonRepeated && timeBetween.TotalMilliseconds < _remoteFirstRepeat)
        {
#if TRACE
          Trace.WriteLine("Skip, First Repeat");
#endif
          return;
        }

        if (_remoteButtonRepeated && timeBetween.TotalMilliseconds < _remoteHeldRepeats)
        {
#if TRACE
          Trace.WriteLine("Skip, Held Repeat");
#endif
          return;
        }

        if (_remoteButtonRepeated && timeBetween.TotalMilliseconds > _remoteFirstRepeat)
          _remoteButtonRepeated = false;
        else
          _remoteButtonRepeated = true;
      }
      else
      {
        _lastRemoteButtonCodeType = codeType;
        _lastRemoteButtonKeyCode = keyCode;
        _remoteButtonRepeated = false;
      }

      _lastRemoteButtonTime = DateTime.Now;

      if (_remoteHandler != null)
        _remoteHandler(Name, keyCode.ToString());
    }
    private void RemoteEvent(IrProtocol codeType, uint keyCode, bool firstPress)
    {
#if TRACE
      Trace.WriteLine(String.Format("Remote: {0}, {1}, {2}", Enum.GetName(typeof(IrProtocol), codeType), keyCode, firstPress));
#endif

      if (!_config.EnableRemoteInput)
        return;

      if (_ignoreAutomaticButtons && codeType == IrProtocol.RC6_MCE)
      {
        // Always ignore these buttones ...
        if (
          //keyCode == 0x7bdc ||  // Back (removed 12-April-2008)
          keyCode == 0x7bdd || // OK
          keyCode == 0x7bde || // Right
          keyCode == 0x7bdf || // Left
          keyCode == 0x7be0 || // Down
          keyCode == 0x7be1 || // Up
          keyCode == 0x7bee || // Volume_Down
          keyCode == 0x7bef || // Volume_Up
          keyCode == 0x7bf1 || // Mute
          keyCode == 0x7bf3 || // PC_Power
          keyCode == 0x7bf4 || // Enter
          keyCode == 0x7bf6 || // Number_9
          keyCode == 0x7bf7 || // Number_8
          keyCode == 0x7bf8 || // Number_7
          keyCode == 0x7bf9 || // Number_6
          keyCode == 0x7bfa || // Number_5
          keyCode == 0x7bfb || // Number_4
          keyCode == 0x7bfc || // Number_3
          keyCode == 0x7bfd || // Number_2
          keyCode == 0x7bfe || // Number_1
          keyCode == 0x7bff) // Number_0
        {
#if TRACE
          Trace.WriteLine("Ignoring remote button due to automatic handling");
#endif
          return;
        }

        // Only ignore Start if the services aren't disabled ...
        if (keyCode == 0x7bf2 && !_config._disableMceServices)
        {
#if TRACE
          Trace.WriteLine("Ignoring Start button due to automatic handling and the MCE services being active");
#endif
          return;
        }
      }

      if (!firstPress && _lastRemoteButtonCodeType == codeType && _lastRemoteButtonKeyCode == keyCode)
      {
        TimeSpan timeBetween = DateTime.Now.Subtract(_lastRemoteButtonTime);

        int firstRepeat = _config.RemoteFirstRepeat;
        int heldRepeats = _config.RemoteHeldRepeats;
        if (_config.UseSystemRatesRemote)
        {
          firstRepeat = 250 + (SystemInformation.KeyboardDelay * 250);
          heldRepeats = (int) (1000.0 / (2.5 + (SystemInformation.KeyboardSpeed * 0.888)));
        }

        if (!_remoteButtonRepeated && timeBetween.TotalMilliseconds < firstRepeat)
        {
#if TRACE
          Trace.WriteLine("Skip, First Repeat");
#endif
          return;
        }

        if (_remoteButtonRepeated && timeBetween.TotalMilliseconds < heldRepeats)
        {
#if TRACE
          Trace.WriteLine("Skip, Held Repeat");
#endif
          return;
        }

        if (_remoteButtonRepeated && timeBetween.TotalMilliseconds > firstRepeat)
          _remoteButtonRepeated = false;
        else
          _remoteButtonRepeated = true;
      }
      else
      {
        _lastRemoteButtonCodeType = codeType;
        _lastRemoteButtonKeyCode = keyCode;
        _remoteButtonRepeated = false;
      }

      _lastRemoteButtonTime = DateTime.Now;

      if (RemoteCallback != null)
        RemoteCallback(Name, keyCode.ToString());
    }