Esempio n. 1
0
        public InputWaiter(string CRsID)
        {
            if (!CRManager.IsConnected(CRsID))
            {
                if (MessageBox.Show("נראה שהקורא כרטיסים אינו מחובר, האם ברצונך להמשיך בכל זאת?", "שגיאה",
                                    MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.No)
                {
                    Dispose();
                    return;
                }
            }

            this.InsertedCRsID = CRsID;
            InitializeComponent();
            id             = new InputDevice(Handle);
            id.KeyPressed += new InputDevice.DeviceEventHandler(m_KeyPressed);
        }
Esempio n. 2
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;
     }
 }