Alex Rivera | Logout

Run code on UI thread without control object present

Asked 2009-01-19T10:57:48.513
14

I currently trying to write a component where some parts of it should run on the UI thread (explanation would be to long). So the easiest way would be to pass a control to it, and use InvokeRequired/Invoke on it. But I don't think that it is a good design to pass a control reference to a "data/background"-component, so I'm searching for a way to run code on the UI thread without the need of having a control available. Something like Application.Dispatcher.Invoke in WPF...

any ideas, thx Martin

Edit
Report

1 Answer

1

What about passing a System.ComponentModel.ISynchronizeInvoke? That way you can avoid passing a Control.

answered 2009-02-02T18:52:55.427

Your Answer