Search code examples
c#winformsiobarcode-scanner

How to Check if User input is from Barcode Scanner or Keyboard?


I am creating a p.o.s application for a cafeteria company in which the cashier scans his employee ID and it shows his information for the transaction.

My Problem is, the cashier can also use their keyboard for their input (employee ID) which is very risky.

if employee(true)
   show employee information
   then add orders
else
   Exception

Currently I just hide TexTbox from the UI, click New Button then set cursor focus on it. Then cashier scans employee id. In this part, the cashier can also type via keyboard and continue transaction.

What is the best way to handle this scenario? The rule is only barcode scanner must be use.

Thanks in regards


Solution

  • You could monitor the time it took for the code to be entered. A reader would enter the code much faster than a human typing it in.