Example #1
0
 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);
 }
Example #2
0
        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);
        }
Example #3
0
 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]));
                     }
                 }
             }
         }
     }
 }
Example #4
0
 public static void SetKeyEventPause(KeyEventConfiguration key, bool paused)
 {
     StartMonitoringKey(key);
     SetKeyEventPause(key.Key, paused);
 }
Example #5
0
 public static void SetTimeBetweenEvents(KeyEventConfiguration key, double timeBetweenEvents)
 {
     StartMonitoringKey(key);
     SetTimeBetweenEvents(key.Key, timeBetweenEvents);
 }
Example #6
0
        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);
        }
Example #7
0
 public static void SetTimeBetweenEvents(KeyEventConfiguration key, double timeBetweenEvents)
 {
     StartMonitoringKey(key);
     SetTimeBetweenEvents(key.Key, timeBetweenEvents);
 }
Example #8
0
 public static void SetKeyEventPause(KeyEventConfiguration key, bool paused)
 {
     StartMonitoringKey(key);
     SetKeyEventPause(key.Key, paused);
 }