Exemplo n.º 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);
 }
Exemplo n.º 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);
        }
Exemplo n.º 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]));
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 4
0
 public static void SetKeyEventPause(KeyEventConfiguration key, bool paused)
 {
     StartMonitoringKey(key);
     SetKeyEventPause(key.Key, paused);
 }
Exemplo n.º 5
0
 public static void SetTimeBetweenEvents(KeyEventConfiguration key, double timeBetweenEvents)
 {
     StartMonitoringKey(key);
     SetTimeBetweenEvents(key.Key, timeBetweenEvents);
 }
Exemplo n.º 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);
        }
Exemplo n.º 7
0
 public static void SetTimeBetweenEvents(KeyEventConfiguration key, double timeBetweenEvents)
 {
     StartMonitoringKey(key);
     SetTimeBetweenEvents(key.Key, timeBetweenEvents);
 }
Exemplo n.º 8
0
 public static void SetKeyEventPause(KeyEventConfiguration key, bool paused)
 {
     StartMonitoringKey(key);
     SetKeyEventPause(key.Key, paused);
 }