Add a list of markers with BackgroundWorker

Topics: WPF
Jul 27, 2011 at 9:08 AM

Hello everyone,
I'm trying to add a set of markers to Gmap control, directly from a BackgroundWorker DoWork method, but the application returns the typical error "invalid operation exception" due to the STA thread mode.
I also tried adding a single marker, either by calling the Dispatcher on the map itself or on the window, but without results.

To some, it happened the same problem?

Thank you.

Coordinator
Jul 27, 2011 at 9:17 AM

use ProgressChanged event

Jul 27, 2011 at 9:48 AM
radioman wrote:

use ProgressChanged event

Hello,
thanks for the reply but this did not solve the problem, however, because the addition of the marker should be done asynchronously by BackgroundWorker. Events such as "ProgressChanged" or "Completed" instead of working directly on the GUI thread.

Coordinator
Jul 27, 2011 at 9:58 AM

you can't add controls/markers in different thread, anyway dispatcher should work fine

Jul 27, 2011 at 10:05 AM
radioman wrote:

you can't add controls/markers in different thread, anyway dispatcher should work fine

Unfortunately, in this case the problem persists even with the dispatcher, I tried to invoke on both the main window, both directly on the control, but nothing ...