frmServer.vb
' 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. ' Imports Microsoft.VisualBasic Imports System Imports System.Collections.ObjectModel Imports System.Linq Imports System.Windows.Forms Imports ESRI.ArcGISExplorer Imports ESRI.ArcGISExplorer.Data Imports ESRI.ArcGISExplorer.Mapping Partial Public Class frmServer Inherits Form Private _serviceLayer As ServiceLayer Private _mapDisp As MapDisplay Private _subServiceName As String Public Sub New() components = Nothing _subServiceName = "" _serviceLayer = Nothing InitializeComponent() _mapDisp = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay cboType.Items.Clear() cboType.Items.Add("GeoRSS") cboType.SelectedIndex = 0 End Sub Private Sub btnCancel_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnCancel.Click Me.Close() End Sub Private Sub btnOK_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnOK.Click Dim item As ServiceLayer = Nothing Dim uri As Uri = New Uri(txtServer.Text) Try If Not String.IsNullOrEmpty(cboType.Text) Then If Text = "GeoRSS" Then Dim geoRSSLyr As GeoRssLayer = New GeoRssLayer(uri, Symbol.Marker.Stickpin.Red) geoRSSLyr.Connect() If (geoRSSLyr.IsConnected) Then _mapDisp.Map.ChildItems.Add(geoRSSLyr) _mapDisp.ZoomToFullExtent() Else MessageBox.Show("Failed to connect to GeoRSS layer:" & Environment.NewLine & Location.ToString(), _ "Error Connecting to GeoRSS", MessageBoxButtons.OK, MessageBoxIcon.Error) End If End If End If Catch ex As Exception MessageBox.Show("Failed to add GeoRSS layer:" & Environment.NewLine & Location.ToString(), _ "Error adding GeoRSS", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try MyBase.Close() End Sub Private Sub cmbType_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles cboType.SelectedIndexChanged btnOK.Enabled = True Select Case cboType.SelectedIndex Case 0 label8.Text = "Example: http://www.server.com/georss.xml" End Select End Sub End Class