0

I'm using a WindowsFormsHost to load into a 3d render object.

in fact I took the handle from it.

my problem is that I wish create some loading screen or similar, but only using a backgroundworker, when I access to my WindowsFormsHost properties (reading, height, width and handle), the thread raise an exception..

how can I solve this thing?

ghiboz
  • 7,863
  • 21
  • 85
  • 131
  • Does [this](http://stackoverflow.com/questions/1862590/how-to-update-gui-with-backgroundworker) apply to you? If not please describe what exception? – Jacob Seleznev Apr 08 '13 at 03:36
  • 1
    Yep, check Jacob link, this is probably just a thread error. You cannot update UI from a background Thread, but you can call the UI thread from background to perform the update. – Ouarzy Apr 08 '13 at 06:03
  • thanks @Ouarzy, how can I call the UI thread? – ghiboz Apr 08 '13 at 11:20

1 Answers1

2

You could update the UI thread as explain in this post: Notify the UI Thread from Background Thread

Roughly: you just need a dispatcher.BeginInvoke (for an async call) on the UI thread.

Community
  • 1
  • 1
Ouarzy
  • 3,015
  • 1
  • 16
  • 19