void frmMap_Disposed(object sender, EventArgs e) { // Unregister callbacks UnregisterClientEvents(client); if (map != null) { if (instance.MonoRuntime) { map.Navigating -= new WebBrowserNavigatingEventHandler(map_Navigating); } else { map.Dispose(); } map = null; } if (mmap != null) { mmap.Dispose(); mmap = null; } }
void createMap() { if (map == null) { mmap = new MapControl(instance); mmap.MapTargetChanged += (object sender, MapTargetChangedEventArgs e) => { txtRegion.Text = e.Region.Name; nudX.Value = e.LocalX; nudY.Value = e.LocalY; lblStatus.Text = "Ready for " + e.Region.Name; }; mmap.ZoomChanged += new EventHandler<EventArgs>(mmap_ZoomChaged); if (instance.Netcom.Grid.ID == "agni") { mmap.UseExternalTiles = true; } mmap.Dock = DockStyle.Fill; pnlMap.Controls.Add(mmap); mmap_ZoomChaged(null, null); zoomTracker.Visible = true; } }