I am developing application on Windows Mobile 6 (uses compact framework). The application uses a barcode scanner. I want to implement keyboard shortcuts in the menu. I have implemented a keypress event in the menu so that if the user presses 1 the first menu item is opened and so on. But my problem is that if the user scans the barcode with the device while the application is in the menu, the application gets the barcode read by the scanner and translates it to keypresses. As I have keyboard shortcuts implemented in submenus as well, this means that if the user scans the barcode in the menu the application moves between menus.
I am not 100% sure but it seems that devices I use have barcode readers as "keyboard wedge" and when they are that kind you get text from them as if the user was typing it from the keyboard.
This is how keypresses in the menu are implemented:
private void mainList_KeyPress(object sender, KeyPressEventArgs e)
{
switch (e.KeyChar)
{
case (char)Keys.D1:
productRequestBtn_Click(sender, e);
break;
case (char)Keys.D2:
warehouseBtn_Click(sender, e);
break;
case (char)Keys.D3:
inventoryBtn_Click(sender, e);
break;
case (char)Keys.D4:
ordersBtn_Click(sender, e);
break;
case (char)Keys.D5:
discountBtn_Click(sender, e);
break;
case (char)Keys.D6:
intakeBtn_Click(sender, e);
break;
case (char)Keys.F1:
Close();
break;
}
}
I have tried different ways to implement it but haven't managed to solve my problem.
If someone has any idea how to either change keyboard shortcuts implemented in menus, block a barcode reader or anything that might work in the described case, I would really appreciate it.