开发者

"calling thread must be STA" error when trying to access an object from another window

开发者 https://www.devze.com 2023-01-14 07:22 出处:网络
I have an application that does data acquisition over a serial port (modbus), and I us开发者_如何学Goe a BackgroundWorker object to call the device because otherwise it takes time and freezes my UI.

I have an application that does data acquisition over a serial port (modbus), and I us开发者_如何学Goe a BackgroundWorker object to call the device because otherwise it takes time and freezes my UI. The problem arises when I open a new WPF window and set its DataContext to be the object I'm updating (I want to use this window to get a detailed view of the device - status, charts, bargraphs). Is there a way of using my data object in another window or should I consider making my app a single windowed one? Thank you


Try checking out the discussion on a similar question that I asked. I think it might help you out. STAThread missing but it is there. I know the title seems a little different, but a lot of the ideas presented might help you out as well.

0

精彩评论

暂无评论...
验证码 换一张
取 消