void lyr_Initialized(object sender, EventArgs e) { ESRI.ArcGIS.Samples.Kml.KmlLayer lyr = sender as ESRI.ArcGIS.Samples.Kml.KmlLayer; //DebugConsole.debug(lyr.Graphics.Count.ToString()); try { _map.Layers.Add(lyr); } catch (Exception ex) { DebugConsole.debug("MapHelper: " + ex.ToString()); } //throw new NotImplementedException(); }
public void addKmlLayer(string kmlUri, string layerID, double opacity) { try { if (layerID == "") { layerID = Guid.NewGuid().ToString(); } ESRI.ArcGIS.Samples.Kml.KmlLayer lyr = new ESRI.ArcGIS.Samples.Kml.KmlLayer(); lyr.Initialized += new EventHandler <EventArgs>(lyr_Initialized); lyr.ProxyUrl = "../ProxyHandler.ashx"; lyr.Source = new Uri(kmlUri); lyr.Opacity = opacity; lyr.ID = layerID; lyr.Visible = true; lyr.Initialize(); //_map.Layers.Add(lyr); } catch (Exception ex) { MessageBox.Show("HapHelper: " + ex.ToString(), "Error", MessageBoxButton.OK); } }