Exemple #1
0
        private void inputDevice_KeyPressed(object sender, InputDevice.KeyControlEventArgs e)
        {
            //TODO: Send the keyboard that the input came from to the controller_changed event instead of the programmer and let the presenter figure it out
            Programmer controllingProgrammer = Programmer.Neither;

            if (string.IsNullOrEmpty(keyboardId1))
            {
                keyboardId1 = e.Keyboard.deviceHandle.ToString();
            }
            else if (string.IsNullOrEmpty(keyboardId2) && e.Keyboard.deviceHandle.ToString() != keyboardId1)
            {
                keyboardId2 = e.Keyboard.deviceHandle.ToString();
            }

            if (e.Keyboard.deviceHandle.ToString() == keyboardId1)
            {
                controllingProgrammer = programmer1;
            }
            if (e.Keyboard.deviceHandle.ToString() == keyboardId2)
            {
                controllingProgrammer = programmer2;
            }

            if (Controller_Changed != null)
            {
                Controller_Changed(this, new ControllerChangedEventArgs(controllingProgrammer));
            }
        }
Exemple #2
0
 private void m_KeyPressed(object sender, InputDevice.KeyControlEventArgs e)
 {
     if ((int)e.Keyboard.deviceHandle == lastDevice)
     {
         count++;
     }
     else
     {
         count      = 0;
         lastDevice = (int)e.Keyboard.deviceHandle;
     }
     if (count == 15)
     {
         Output = e.Keyboard;
         found  = true;
     }
 }
Exemple #3
0
 private void m_KeyPressed(object sender, InputDevice.KeyControlEventArgs e)
 {
     if (DateTimeExtensions.ApplicationIsActivated(Process.GetCurrentProcess().Id) && e.Keyboard.deviceName == InsertedCRsID && CRManager.IsConnected(InsertedCRsID))
     {
         if (skip)
         {
             Console.WriteLine(e.Keyboard.vKey + ":" + e.Keyboard.key);
             if (e.Keyboard.vKey == Keys.Enter.ToString())
             {
                 SystemSounds.Beep.Play();
                 id.KeyPressed -= m_KeyPressed;
                 Close();
             }
         }
         skip = !skip;
     }
     else
     {
         Output = String.Empty;
         skip   = false;
     }
 }