Visual Basic (Declaration) | |
---|---|
Public MustInherit NotInheritable Class ArcGISRuntime |
C# | |
---|---|
public static class ArcGISRuntime |
The ArcGISRuntime class represents the runtime deployment folder used by your application and must be licensed and initialized correctly before other runtime components can be used. To initialize the ArcGIS Runtime you should:
- Set the license by calling the SetLicense method with a valid license string. The license string syntax can be obtained from the License Viewer tool included with the SDK and accessed from the Start Menu under Start > Programs > ArcGIS > Runtime SDK <version> for WPF > Runtime Tools > License Viewer. The License Viewer tool enables you to construct the correct license string based on license type (test or deployment), language (C# or VB.NET), product level (Basic or Standard) and extensions. As a developer, when you license the ArcGIS Runtime SDK for WPF you license your machine for all available product levels and extensions. If you do not set the license explicitly, the runtime will look for a developer license during initialization.
- Ensure a valid runtime deployment is available. By default the API will automatically look for a runtime folder during initialization. It will first check the location of your application executable for a valid runtime deployment folder. If one is not found adjacent to your application, the API will then check for an installation of the ArcGIS Runtime SDK for WPF. If a valid runtime deployment folder is not found in either of these locations the initialization will fail with an exception. Alternatively, you can set the InstallPath property to skip the automatic search and use a different path.
- Initialize the runtime deployment by calling the Initialize method. This will confirm that both the license and the runtime deployment folder are valid. If a problem is encountered with either the license or the runtime deployment, an exception will be raised.
Your code to initialize the runtime deployment must be placed before any other runtime components are accessed. This includes any objects defined in XAML.
The following code shows how to initialize a runtime deployment using the ArcGISRuntime class members.
C# | Copy Code |
---|---|
// Use the License Viewer tool to obtain the license string (including SetLicense syntax). ArcGISRuntime.SetLicense("License string."); // Optionally set the location of the runtime deployment folder if not adjacent to the executable or using the SDK installation. // e.g. ArcGISRuntime.InstallPath = @"..\RuntimeDeploymentFolder"; try { ArcGISRuntime.Initialize(); } catch (Exception runtimeInitException) { // Handle runtime initialization failure. } |
VB.NET | Copy Code |
---|---|
' Use the License Viewer tool to obtain the license string (including SetLicense syntax). ArcGISRuntime.SetLicense("License string.") ' Optionally set the location of the runtime deployment folder if not adjacent to the executable or using the SDK installation. ' e.g. ArcGISRuntime.InstallPath = @"..\RuntimeDeploymentFolder"; Try ArcGISRuntime.Initialize() ' Handle runtime initialization failure. Catch runtimeInitException As Exception End Try |
System.Object
ESRI.ArcGIS.Client.ArcGISRuntime
Target Platforms: Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family, Windows 7, Windows 8