I have been fighting for several days with a problem of
I have the following code in the main form (which modifies a GMAPControler object in the form):
// RE-DRAW MAP
public void reloadMapOverlay(GMapOverlay overlay)
{
try
{
Invoke(new Action(() => this.map_Box.Overlays.Add(overlay)));
}
catch (Exception e)
{
Console.WriteLine("reloadMapOverlay: {0}", e);
this.setError("reloadMapOverlay: " + e);
}
}
and in another class (Map_Custom.cs) I call the previous function:
addRoute(){
Console.WriteLine("Route");
route.Points.Add(coords.get_position());
overlay.Routes.Add(route);
mainForm.reloadMapOverlay(overlay);}
(addRoute is called by a thread:
Thread addRoute = new Thread(new ThreadStart(map.addRoute));
addRoute.IsBackground = true;
addRoute.Start();
)
- Errors jumps me in the overlay object.
pd: doing tests, if in
Invoke(new Action(() => this.map_Box.Overlays.Add(overlay)));
I put
Invoke(new Action(() => this.map_Box.Overlays.Add(new GMapOverlay("A"))));
I have no failures, but of course, the thing is to pass an overlay with data and not create a new one every time.
a greeting.