public AGSLocator(string name, string url) { this.Name = name; this.ErrorMessage = ""; if (string.IsNullOrEmpty(this.Name)) { this.IsVerified = false; this.ErrorMessage = AfaStrings.InvalidServerURL; return; } if (!Uri.IsWellFormedUriString(url, UriKind.Absolute)) { this.IsVerified = false; this.ErrorMessage = AfaStrings.InvalidServerURL; return; } this.URL = url; try { string[] separator = new string[] { "/rest/services" }; string[] array = url.Split(separator, StringSplitOptions.None); string text = array[0] + "/rest/services"; if (text.ToLower() == AGSLocator.ArcGISOnlineLocatorsURL) { if (AGSLocator.ArcGISOnlineLocatorConnection == null) { AGSLocator.ArcGISOnlineLocatorConnection = new AGSConnection("ArcGIS Online Locators", AGSLocator.ArcGISOnlineLocatorsURL); } this.ParentConnection = AGSLocator.ArcGISOnlineLocatorConnection; } else if (text.ToLower() == AGSLocator.ArcGISComLocatorsURL) { if (AGSLocator.ArcGISComLocatorConnection == null) { AGSLocator.ArcGISComLocatorConnection = new AGSConnection("ArcGIS.Com Locators", AGSLocator.ArcGISComLocatorsURL); } this.ParentConnection = AGSLocator.ArcGISComLocatorConnection; } else if (text.ToLower() == AGSLocator.ArcGISGeocoderURL) { if (AGSLocator.ArcGISGeocoderConnection == null) { AGSLocator.ArcGISGeocoderConnection = new AGSConnection("ArcGIS Geocoder", AGSLocator.ArcGISGeocoderURL); } } else { this.ParentConnection = AGSConnection.FindExistingConnection(text); if (this.ParentConnection == null) { try { this.ParentConnection = new AGSConnection(name + " Connection", text); if (this.ParentConnection == null) { this.IsVerified = false; this.ErrorMessage = AfaStrings.InvalidServerURL; return; } App.Connections.Add(this.ParentConnection); } catch { this.IsVerified = false; this.ErrorMessage = AfaStrings.InvalidServerURL; return; } } } } catch { this.IsVerified = false; this.ErrorMessage = AfaStrings.InvalidServerURL; return; } this.Properties = new Dictionary <string, string>(); if (!this.GetServerInfo()) { this.IsVerified = false; return; } this.IsVerified = true; }