I’m using System.ComponentModel.BackgroundWorker to execute some longer running task that – in the end – will update some UI elements.
Questions regarding this:
- Is
BackgroundWorker.RunWorkerCompletedexecuted on the UI main thread, or in a separate thread? Or asked differently: do I have to embed my code inusing(NSAutoReleasePool)and do I have toInvokeOnMainThread()like would have to when using a normal thread? - Do I have to use
NSAutoReleasePoolinside theBackgroundWorker.DoWorkdelegate?
BackgroundComponentWorker has not been adapted to work on MonoTouch or Mono for Android, so it does not do anything special with the UI thread.
Any of the events raised are not raised on the UI thread so you need to manually wrap those in BeginInvokeOnMainThread.