private void addGeoRssLayer(UrlChosenEventArgs e) { if (e.Url == null) return; Uri targetUri = null; if (!Uri.TryCreate(e.Url, UriKind.Absolute, out targetUri)) { return; } if (View.Instance != null) { CustomGeoRssLayer geoRssLayer = new CustomGeoRssLayer() { Source = targetUri, ID = Guid.NewGuid().ToString("N"), }; Core.LayerExtensions.SetDisplayUrl(geoRssLayer, e.Url); geoRssLayer.SetValue(ESRI.ArcGIS.Client.Extensibility.MapApplication.LayerNameProperty, targetUri.Host); geoRssLayer.MapSpatialReference = View.Instance.Map.SpatialReference; geoRssLayer.UpdateCompleted +=new EventHandler(applyAutomaticClustering); View.Instance.Map.Layers.Add(geoRssLayer); } MapApplication.Current.HideWindow(enterUrlDialog); OnUrlChosen(e); }
protected override void WriteAttributes(Layer layer) { base.WriteAttributes(layer); CustomGeoRssLayer geoRssLayer = layer as CustomGeoRssLayer; if (geoRssLayer != null) { base.WriteAttribute("IsItemOnClickBehaviorEnabled", geoRssLayer.IsItemOnClickBehaviorEnabled.ToString()); if (geoRssLayer.Source != null) { writer.WriteAttributeString("Source", geoRssLayer.Source.AbsoluteUri); } if (geoRssLayer.MapSpatialReference != null) { WriteSpatialReferenceAsAttribute(writer, Namespaces, "MapSpatialReference", geoRssLayer.MapSpatialReference); } if (geoRssLayer.LayerSpatialReference != null) { WriteSpatialReferenceAsAttribute(writer, Namespaces, "LayerSpatialReference", geoRssLayer.LayerSpatialReference); } } }