コード例 #1
0
        private void Keyboard_KeyPressed(object sender, KeyEventArgs e)
        {
            if (!WaitDescriptor.IsMatch(e))
            {
                return;
            }


            var time = DateTime.Now;

            if (time.TimeOfDay - _lastPressTime.TimeOfDay > _maxKeysPressingInterval)
            {
                _currentPressCount = 0;
            }
            _lastPressTime = time;
            lock (s_counterSync)
            {
                _currentPressCount++;
            }
            PressedKeyArgs = e;
            if (_currentPressCount == PressTimes)
            {
                ThreadUtils.StartBackgroundThread(WaitForSet);
            }
        }
コード例 #2
0
 private void Keyboard_KeyPressed(object sender, KeyEventArgs e)
 {
     lock (_sync)
     {
         if (!WaitDescriptor.IsMatch(e))
         {
             return;
         }
         PressedKeyArgs = e;
         Set();
     }
 }