CashDrawer.WaitForDrawerClose 期间事件堆积

发布于 2024-08-02 18:25:14 字数 183 浏览 6 评论 0原文

我正在编写 POS 应用程序并使用 POS for .NET。我发现,当我调用 WaitForDrawerClose 方法时,虽然应用程序将无响应地等待直到抽屉关闭(根据需要),但其他地方的任何点击似乎都会堆积在队列中,并且一旦抽屉关闭,所有点击都会触发。只要 WaitForDrawerClose 尚未返回,如何让我的应用程序停止侦听这些事件?谢谢!

I'm writing an application for a POS and using POS for .NET. I've found that when I call the WaitForDrawerClose method, while the application will sit and wait unresponsively until the drawer is closed (as desired), any clicks elsewhere seem to pile up in the queue and all fire once the drawer has been closed. How can I make my app stop listening for these events so long as WaitForDrawerClose has not yet returned? Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

扛起拖把扫天下 2024-08-09 18:25:14

您可以完全避免调用 WaitForDrawerClose,并自行处理逻辑。

只需收听 OnDrawerStateChanged 事件来通知抽屉何时关闭。这将让您退出例程,更新 UI(禁用按钮以防止事件触发等),然后在抽屉关闭时干净地重新启用所有内容,而不是在该点同步阻塞(这会导致您的问题) 。

这需要花费更多的精力,因为它比单行方法需要更多的工作,但是如果用户没有执行他们应该执行的操作,它可以让您更好地控制应用程序的反应方式。您甚至可以让导航屏幕告诉用户(在一定的延迟后)他们需要关闭抽屉,执行比标准蜂鸣声更多的操作等。

You could avoid calling WaitForDrawerClose entirely, and handle the logic yourself.

Just listen for the OnDrawerStateChanged event instead to tell when the drawer is closed. Instead of synchronously blocking at that point (which is causing your problem), this would let you just exit your routine, update your UI (disable buttons to prevent events from firing, etc), and then re-enable everything cleanly when the drawer closes.

It's a bit more effort, since it's more work than a one line method, but it gives you a LOT more control over how your application will react if the user doesn't do what they're supposed to do. You even could have nag screens tell the user (after a certain delay) that they need to close the drawer, do more than the standard beeping, etc.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文