Пример #1
0
 /// <summary>
 /// Handles the form's KeyPress event.
 /// </summary>
 /// <param name="sender">The sender of the event.</param>
 /// <param name="e">An KeyPressEventArgs object that contains the
 /// event data.</param>
 private void KeyPressed(object sender, KeyPressEventArgs e)
 {
     // PDTS 1064
     if (m_cardSearchRadio.Checked && m_magCardReader.ProcessCharacter(e.KeyChar))
     {
         e.Handled = true; // Don't send to the active control.
     }
 }
Пример #2
0
        /// <summary>
        /// Handles the form's KeyPress event.
        /// </summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="e">An KeyPressEventArgs object that contains the
        /// event data.</param>
        private void OnKeyPress(object sender, KeyPressEventArgs e)
        {
            NotIdle();

            // PDTS 1064
            if (m_readWholeCard)
            {
                if (waitingForCardByte == null) //setup a timer to detect when the card is read
                {
                    waitingForCardByte          = new Timer();
                    waitingForCardByte.Tick    += new EventHandler(waitingForCardByte_Tick);
                    waitingForCardByte.Interval = 500;
                    waitingForCardByte.Start();

                    if (AnalyzingCards)
                    {
                        m_messageLabel.Visible = false;
                        lblAnalyze.Visible     = false;
                        lblPleaseWait.Visible  = true;
                    }
                }
                else
                {
                    waitingForCardByte.Stop();
                    waitingForCardByte.Interval = 500;
                    waitingForCardByte.Start();
                }

                m_cardData.Append(e.KeyChar);

                e.Handled = true; // Don't send to the active control.
            }
            else // Normal reading.
            {
                if (m_EatCharacters)
                {
                    TestTimer.Stop();
                    TestTimer.Interval = 500;
                    TestTimer.Start();

                    e.Handled = true;
                    return;
                }

                if (TestingCards && !m_magCardReader.MSRInputInProgress && !m_magCardReader.MSRStartCharacters.Contains(e.KeyChar.ToString()))
                {
                    if (e.KeyChar != '\x0D')
                    {
                        m_EatCharacters = true;
                    }

                    TestTimer          = new Timer();
                    TestTimer.Interval = 500;
                    TestTimer.Tick    += new EventHandler(TestTimer_Tick);
                    TestTimer.Start();
                }

                if (m_magCardReader.ProcessCharacter(e.KeyChar))
                {
                    e.Handled = true; // Don't send to the active control.
                }
            }
        }