I have commercial equipment with which I can connect to the .Net library provided by the equipment manufacturer, so I can not control the library or equipment, only my code.
The manufacturer installed his system so that if you are not connected to the equipment through your library, then it works fine. However, when you connect to your library, there is an implicit requirement that you service the Windows message pump at a speed set by the hardware speed. This is due to the fact that their library has an event system that you can subscribe to this technology for, but they assume that your application code will be based on WinForms. (But there is nothing explicit mention of this in their documentation - only that all 2 of their .Net sample programs are based on WinForms.) I confirmed with my technical support that the expectation is that you will use the WinForms application.
In my case, I am writing a C # -based application other than WinForms (actually it is a Windows service, so I donโt have a user interface thread), and although I am connecting to the equipment, I am not subscribing to any of the events. As a result, I Found that I need a reference to the WinForms assembly and call Application.DoEvents () at a high enough speed to serve all those events that I did not subscribe to.
So my questions are:
- In this case, you call Application.DoEvents () is just my option?
- Or is there a more modern way to do this?
- What are the consequences of calling DoEvents () at a speed of 20 ms?
- Unrelated, but if I wrote a WPF-based application, could this program serve a message pump?
Edit
, Windows ( ), , .
2
, , 2 3 , Windows.