protected internal KeyDownEventArgs(KeyEventConfiguration keycfg) { KeyConfig = keycfg; IsShift = Keyboard.Keyboard.GetAsyncKeyState(Keys.ShiftKey); IsAlt = Keyboard.Keyboard.GetAsyncKeyState(Keys.Menu); IsCtrl = Keyboard.Keyboard.GetAsyncKeyState(Keys.LControlKey) || Keyboard.Keyboard.GetAsyncKeyState(Keys.RControlKey); }
public static void StartMonitoringKey(KeyEventConfiguration key) { for (int i = 0; i < keyConfigs.Count; i++) { // if the current Keys value is being monitored... if (keyConfigs[i].Key == key.Key) { keyConfigs[i] = key; return; } } // if code gets here, Keys value not being monitored yet keyConfigs.Add(key); }
public static void RaiseKeyEvents(long tick) { if (KeyDown != null) { if (!allPause) { for (int i = 0; i < keyConfigs.Count; i++) { if (keyConfigs[i].ReadyForNextEvent(tick)) { if (GetAsyncKeyState(keyConfigs[i].Key)) { KeyEventConfiguration key = keyConfigs[i]; key.LastKeyEvent = tick; keyConfigs[i] = key; KeyDown(new KeyDownEventArgs(keyConfigs[i])); } } } } } }
public static void SetKeyEventPause(KeyEventConfiguration key, bool paused) { StartMonitoringKey(key); SetKeyEventPause(key.Key, paused); }
public static void SetTimeBetweenEvents(KeyEventConfiguration key, double timeBetweenEvents) { StartMonitoringKey(key); SetTimeBetweenEvents(key.Key, timeBetweenEvents); }