frmServer.cs
// Copyright 2011 ESRI // // All rights reserved under the copyright laws of the United States // and applicable international laws, treaties, and conventions. // // You may freely redistribute and use this sample code, with or // without modification, provided you include the original copyright // notice and use restrictions. // // See the use restrictions. // using System; using System.Collections.ObjectModel; using System.Linq; using System.Windows.Forms; using ESRI.ArcGISExplorer; using ESRI.ArcGISExplorer.Data; using ESRI.ArcGISExplorer.Mapping; namespace MapContentUpdatesCS { public partial class frmServer : Form { private MapDisplay _mapDisp; public frmServer() { components = null; InitializeComponent(); _mapDisp = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay; cboType.Items.Clear(); cboType.Items.Add("GeoRSS"); cboType.SelectedIndex = 0; } private void btnCancel_Click(object sender, EventArgs e) { this.Close(); } private void btnOK_Click(object sender, EventArgs e) { ServiceLayer item = null; Uri location = new Uri(txtServer.Text); try { if (!String.IsNullOrEmpty(cboType.Text)) { if (cboType.Text == "GeoRSS") { GeoRssLayer geoRSSLyr = new GeoRssLayer(location, Symbol.Marker.Stickpin.Red); geoRSSLyr.Connect(); if (geoRSSLyr.IsConnected) { _mapDisp.Map.ChildItems.Add(item); _mapDisp.ZoomToFullExtent(); } else { MessageBox.Show("Failed to connect to GeoRSS layer:" + Environment.NewLine + location.ToString(), "Error Connecting to GeoRSS", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } catch { MessageBox.Show("Failed to add GeoRSS layer:" + Environment.NewLine + location.ToString(), "Error Adding GeoRSS", MessageBoxButtons.OK, MessageBoxIcon.Error); } base.Close(); } private void cmbType_SelectedIndexChanged(object sender, EventArgs e) { btnOK.Enabled = true; switch (cboType.SelectedIndex) { case 0: label8.Text = "Example: http://www.server.com/georss.xml"; break; } } } }