Displaying Active Events in C#
This sample applies to
- Visual Studio 2005
- TcEventLogger 2.9.0.90 and above (Shipped since TwinCAT 2.10. Build1244)
Before starting with the sample be aware that the TcEventViewer ActiveX does provide a fully featured implementation of an event HMI which can easily be added to your application. If you have special needs that cant be realized using the standard TcEventViewer proceed with the sample to display a list of active events.
- This sample builds on the sample 'Displaying Logged Events in C#'
- To implement a program capable of displaying active events we will need to extend the previous sample with the folowing features:
- Add events dynamically as they occur
- Remove inactive events from the listview.
- Associate an event with one entry in the listview.
- If we use the Eventloggers callback methods to be notified about event state changes we need to make our application threadsafe. This will include defining some critical sections, using the lock directive on the one hand and access to the ListView on the other hand. Accessing Windows controls from different threads does not work in general. You can use delegate methods and the ListViews Invoke method for synchronization.
- See the complete project for a very basic implementation of the
points mentioned above.
This implementation does not deal with event confirmations.
Language / IDE |
Source code |
---|---|
Visual Studio 2005 |