/// <summary> /// Adds an emulated keypress to the queue of the provider. /// </summary> /// <param name="keypress">Keystroke information</param> /// <remarks>The provider can play back emulated key strokes</remarks> public void QueueKeyPress(EmulatedKeyStroke keypress) { lock (_emulatedKeyStrokes) { if (_emulatedKeyStrokes.Count == 0) { _emulatedKeyStrokes.Enqueue(keypress); return; } var last = _emulatedKeyStrokes.Peek(); if (last.PrimaryCode == keypress.PrimaryCode && last.SecondaryCode == keypress.SecondaryCode) { // --- The same key has been clicked if (keypress.StartTact >= last.StartTact && keypress.StartTact <= last.EndTact) { // --- Old and new click ranges overlap, lengthen the old click last.EndTact = keypress.EndTact; return; } } _emulatedKeyStrokes.Enqueue(keypress); } }
/// <summary> /// Adds an emulated keypress to the queue of the provider. /// </summary> /// <param name="keypress">Keystroke information</param> /// <remarks>The provider can play back emulated key strokes</remarks> public void QueueKeyPress(EmulatedKeyStroke keypress) { _emulatedKeyStrokes.Enqueue(keypress); }