Initializes a new instance of the Link class with the specified name and Uri.

Namespace:  ESRI.ArcGISExplorer.Mapping

Assembly:  ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)

Syntax

C#
public Link(
	string name,
	Uri url
)
Visual Basic (Declaration)
Public Sub New ( _
	name As String, _
	url As Uri _
)

Parameters

name
Type: System..::.String

The name of the new Link; appears in the ArcGIS Explorer contents window when the Link is added to the Map.
url
Type: System..::.Uri

A Uri referring to the target web address of the Link.

Remarks

This overload of the Link constructor can be used to create a new Link referring to a web address by passing in a Uri object as the url parameter. The Uri class is part of the .NET Framework, represents a uniform resource identifier (URI). Using this class when creating a link to a web resource can help make code more robust by throwing exceptions if the resource address specified is formatted incorrectly; for more information refer to the Exception section of the help for the Uri members.

The name parameter is used to set the inherited Name of the Link, and the url parameter is used to set the Path of the Link.

Examples

The code below demonstrates how you can add a Link to the Map which refers to a web address. A Link is created using the overloaded constructor which sets the Name and Uri properties of the new Link. The Link is then added to the map. The UriFormatException filter will trap any errors which arise from the web address being entered incorrectly; the example code by default will not throw this exception.
CopyC#
string explorerRc = "http://resources.esri.com/arcgisexplorer/";
try
{
  // Create a new link to the ESRI website by creating a Uri.
  Link resourceCenterLink = new Link("ArcGIS Explorer Resource Center", new Uri(explorerRc));

  // Add the Link to the Map.
  ESRI.ArcGISExplorer.Mapping.MapDisplay disp = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay;
  disp.Map.ChildItems.Add(resourceCenterLink);
}
catch (System.UriFormatException)
{
  MessageBox.Show("Could not add the Link as the URL " + explorerRc + " is not correctly formatted");
}
CopyVB.NET
Dim explorerRc As String = "http://resources.esri.com/arcgisexplorer/"
Try
  ' Create a new link to the ESRI website by creating a Uri.
  Dim resourceCenterLink As Link = New Link("ArcGIS Explorer Resource Center", New Uri(explorerRc))

  ' Add the Link to the Map.
  Dim disp As ESRI.ArcGISExplorer.Mapping.MapDisplay = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay
  disp.Map.ChildItems.Add(resourceCenterLink)

Catch ex As System.UriFormatException
  MessageBox.Show("Could not add the Link as the URL " & explorerRc & " is not correctly formatted")
End Try

See Also