楔形"从键盘&QUOT处理输入的最佳方法; [英] Best way to handle input from a keyboard "wedge"

查看:137
本文介绍了楔形"从键盘&QUOT处理输入的最佳方法;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一个C#的POS(销售点)系统,该系统采用从键盘楔磁卡阅读器输入。这意味着,当输入读取关闭一个磁条的任何数据,就好像它是在键盘上很快键入。目前,我被附加到KeyPress事件,并寻找一系列包含刷卡定点字符非常快的按键处理这一点。

I'm writing a C# POS (point of sale) system that takes input from a keyboard wedge magcard reader. This means that any data it reads off of a mag stripe is entered as if it were typed on the keyboard very quickly. Currently I'm handling this by attaching to the KeyPress event and looking for a series of very fast key presses that contain the card swipe sentinel characters.

有没有更好的办法应对这种输入?

Is there a better way to deal with this sort of input?

编辑:设备不会简单地呈现数据,按键和通过其他驱动程序不接口。此外,我们使用范围广,这些类型的设备,所以最好的方法应该独立工作楔形的具体型号被使用。但是,如果没有其他的选择,我会不得不凑合。

The device does simply present the data as keystrokes and doesn't interface through some other driver. Also We use a wide range of these types of devices so ideally a method should work independent of the specific model of wedge being used. However if there is no other option I'll have to make do.

推荐答案

有一件事你可以做的是,你应该能够配置楔形的读者,使其前或后的字符串呈现一个或多个转义字符。你可以使用这些转义字符来知道你是即将有(或只是有一个)磁卡输入。

One thing you can do is that you should be able to configure your wedge reader so that it presents one or many escape characters before or after the string. You would use these escape characters to know that you are about to have (or just had) a magcard input.

这同样的技术被用来通过条形码阅读器的设备,所以你的应用程序知道获得焦点或处理来自设备的数据输入。

This same technique is used by barcode reader devices so you application knows to get focus or handle the data input from the device.

负这种方法是,你必须正确地配置您的外部设备。这可能是一个问题,部署

The negative to this approach is that you have to properly configure your external devices. This can be a deployment issue.

这假定您的设备只需出示的数据,击键和不通过一些其他的驱动接口。

This assumes that your devices simply present the data as keystrokes and don't interface through some other driver.

这篇关于楔形"从键盘&QUOT处理输入的最佳方法;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆