如何在后台任务中监听按键事件

时间:2016-06-27 09:00:14

标签: c# .net raspberry-pi background-process windowsiot

我有一个条形码扫描仪,它将被Windows(IoT)识别为键盘,我喜欢写一个conditions = ["(allocation_incident_links.valid_from IS NULL OR allocation_incident_links.valid_from < action_events.date) AND (allocation_incident_links.valid_to >= action_events.date OR allocation_incident_links.valid_to IS NULL) AND incidents.confirmed_at >= ? AND incidents.confirmed_at < ? AND ifr94.field_type = ? AND ifr94.field_id = itusf94.id AND itusf94.incident_user_standard_field_id = ? AND (incidents.status_code = ? OR incidents.status_code = ? OR incidents.status_code = ?) AND (incidents.incident_type_id = ?) AND ifr94.incident_id = incidents.id", Fri, 01 Jan 2010, Wed, 01 Jun 2016, "IncidentTypeUserStandardField", "94", 1, 4, 2, 2] ,如果扫描了新的条形码,它会触发事件。如何在Windows IoT的后台任务中听取键盘的按键事件?

1 个答案:

答案 0 :(得分:1)

查看以下讨论(在Windows Mobile 6.5中使用c#中的键盘钩子进行描述):http://www.intermec.com/site/realtime/SingleArticleList.aspx?id=17093 不幸的是,Windows 10 IoT Core中没有消息泵(因为没有gui),所以这个示例不适合你。 一个更好的解决方案是利用串口条码扫描器,设置线程来收听串口,然后进行处理。收听串口的示例如下:https://developer.microsoft.com/en-us/windows/iot/win10/samples/serialsample 任何串口扫描器都可以(例如Motorola Symbol LS2208)