Launches a new process, passing in the path of the Link as the target.

Namespace:  ESRI.ArcGISExplorer.Mapping

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

Syntax

C#
public void Launch()
Visual Basic (Declaration)
Public Sub Launch

Remarks

A new separate process is started when Launch is called:

  • If the Path is a web address, the specified web page will be opened in your default internet browser.
  • If the Path is a file path to an executable, the executable is started; the executable must installed on the machine or otherwise accessible.
  • If the Path is a non-executable file, the default windows action will be taken for that file. Typical examples of files you may link to are PDFs, images, spreadsheets, text files and so on; any file with an associated default action in Windows can be specified (files which when double-clicked in Windows Explorer open automatically without needing to pick a program to open with).

Examples

The code below finds all Links in the Map using the GetMapItems method on the Map class. Then providing there is at least one Link, launches the first link found using the Launch method. If the Launch throws a Win32Exception, the Path property is used to retrieve the file extension of the target of the Link in order to report the failure to the user.
CopyC#
// Find all the Links in the Map.
ESRI.ArcGISExplorer.Mapping.MapDisplay disp = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay;
System.Collections.ObjectModel.ReadOnlyCollection<Link> allLinks = disp.Map.GetMapItems<Link>();

// If there is at least one Link.
if (allLinks.Count > 0)
{
  try
  {
    // Launch the link.
    allLinks[0].Launch();
  }
  catch (System.ComponentModel.Win32Exception)
  {
    // Catch cases where the file type cannot be launched.
    string ext = System.IO.Path.GetExtension(allLinks[0].Path);
    MessageBox.Show("Could not find an associated application for the file type: " + ext);
  }
}
CopyVB.NET
' Find all the Links in the Map.
Dim disp As ESRI.ArcGISExplorer.Mapping.MapDisplay = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay
Dim allLinks As System.Collections.ObjectModel.ReadOnlyCollection(Of Link) = disp.Map.GetMapItems(Of Link)()

' If there is at least one Link.
If allLinks.Count > 0 Then
  Try
    ' Launch the link.
    allLinks(0).Launch()

  Catch ex As System.ComponentModel.Win32Exception
    ' Catch cases where the file type cannot be launched.
    Dim ext As String = System.IO.Path.GetExtension(allLinks(0).Path)
    MessageBox.Show("Could not find an associated application for the file type: " & ext)

  End Try
End If

Exceptions

ExceptionCondition
System.ComponentModel..::.Win32ExceptionThe file type referred to by the Link must have a default action associated with it in Windows in order to be launched, and the file type must be accessible. Refer to the Start(String) method on the .NET Framework System.Diagnostics.Process class for more information.

See Also