4/21/2021 11:41 AM | |
Joined: 7/25/2017 Last visit: 7/11/2024 Posts: 312 Rating: (47) |
Hi, For those creating Openness applications in c#, which subscribe to the Confirmation (and/or Notification?) events for handling user prompts in TIA Portal, please note this because it had me stuck for a while These events do not fire properly if you have attached to TIA in a STAThread environment (such as used in WinForms and WPF applications). This is presumably because the openness .DLLs were compiled as MTA and is a common issue with using MTA DLLs in STA applications. If you trigger an event handled by a STA application, TIA portal locks up but you don't get any event fire in your application. When you close your application, TIA portal is released and shows the confirmation dialog (e.g. confirm delete, do you want to save your changes, etc). The solution is to start your TIA interface in a separate MTA thread. I have attached a simple console app that demonstrates this. It logs TIA Confirmation events to the console. When you set MAKE_EVENTS_WORK = false, the above behaviour occurs. When true, everything is fine. Hope that helps. AttachmentConsoleTests.zip (232 Downloads) |
This contribution was helpful to3 thankful Users |
Follow us on