Greatmaps Blocks when selecting Map ServiceProvider

Topics: Windows Forms
Feb 12, 2012 at 6:37 AM

Hello !

Fantastic project, thanks guys. I knew nothing about mapping before i looked at it and it was SO easy to get going.

I seem to be having a problem with the initialisation of the Greatmaps component on startup. Obviously when you initially start your project the component connects to the internet and downloads the relevant tiles for the startpoint. My problem is that this seems to block my entire application, with the entire system freezing until the component is ready to display the first of the tiles. This happens during initialisation, when I call the code which sets up the MapService Provider (in this case Google).

Can you tell me how I go about working around this ? I want the form to load and show, with the map component to stay blank and then display map tiles as they com down, but I want the rest of the form to be responsive.

Below is the code snippet where I set up this component. (It's mostly test code right now, so ignore the lines which seem superfluous).

The entire app (not just this form, it's an MDIForm Windows Forms app) hangs while the code executes :

MainMap.MapProvider = GMapProviders.GoogleMap;

 

 

 

private void frmPatrolDisplay_Load(object sender, EventArgs e)

{

MainMap.Dock =DockStyle.Fill; new GMapRoute("theRoute")); GMapProviders.GoogleMap; GeoCoderStatusCode status = GeoCoderStatusCode.Unknow; PointLatLng? here = GMapProviders.GoogleMap.GetPoint("39 Old Main Road, Pinetown, South Africa", out status);

MainMap.Overlays.Add(marks);

MainMap.Overlays.Add(routes);

 

routes.Routes.Add(

MainMap.MapProvider =

 

 

 

if (here != null && status == GeoCoderStatusCode.G_GEO_SUCCESS)

{

pnt.Position = here.Value;

marks.Markers.Add(pnt);

MainMap.ZoomAndCenterMarkers(

"markers"); }marks.Markers.Add(pnt);this.Show();

MainMap.Zoom = 16;

 

 

 

}

 

Coordinator
Feb 12, 2012 at 8:00 AM

GoogleMap provider downloads version information, it takes few seconds, you can shown splash screen or something...

Feb 12, 2012 at 8:15 PM

Thanks very much ! That is what I thought but I thought there may be something I missed.

Thanks again for the help.