ArcGIS Runtime SDK for WPF - Library Reference
LocalServer Class
Members  Example  See Also 
ESRI.ArcGIS.Client.Local Namespace : LocalServer Class

The static LocalServer class enables a number of LocalService types to be created based on local geographic content.

Object Model

LocalServer Class

Syntax

Visual Basic (Declaration) 
Public MustInherit NotInheritable Class LocalServer 
C# 
public static class LocalServer 

Remarks

Before using the the LocalServer the runtime deployment must be licensed with a valid license string. For more information please see the ArcGISRuntime class. Once the license string has been set and the ArcGISRuntime initialized, the recommended approach to start the LocalServer is by calling the asynchronous InitializeAsync method and listening for the InitializeCompleted event or by using the overloaded Initialize(Action) method and passing in an action callback delegate.

Once initialized the InitializationError property should be checked to confirm there were no problems encountered starting the LocalServer. To determine the current state of the LocalServer the Status property will provide a LocalServerStatus value or alternatively the property IsRunning can be used to quickly determine whether the LocalServer is currently running.

Finally, when the LocalServer is no longer required the asynchronous ShutdownAsync method should be called to shutdown the LocalServer and recover any resources being used. Once the LocalServer has shutdown it will trigger the ShutdownCompleted event, or alternatively you can use the overloaded ShutdownAsync(Action) method to provide an action callback delegate.

It is not necessary to work with the LocalServer directly. Instead, creating and starting the individual LocalService classes ( LocalMapService, LocalFeatureService, LocalGeocodeService, LocalGeometryService, and LocalGeoprocessingService) will start the LocalServer if it is not already running.

Example

This example shows the one approach to starting the LocalServer by calling InitializeAsync and using a lambda expression to handle the callback inline. The code which is executed in the callback first checks the status of the LocalServer via the InitializationError property before proceeding. This example shows recommended approach to initializing the LocalServer by first setting the license via the SetLicense method then registering an event handler for the InitializationCompleted event and calling the default InitializeAsync method. The code which is executed in the event handler first checks checks the status of the LocalServer via the InitializationError property and the LicenseStatus of the LocalServer before proceeding.
C#Copy Code
// Initialize the LocalServer using a lambda expression to handle the callback
LocalServer.InitializeAsync(() =>
{
    // Check the LocalServer InitializationError property
    if (LocalServer.InitializationError != null)
    {
        // The LocalServer encountered an error or did not start correctly
        // ...
        return;
    }
});
VB.NETCopy Code
' Initialize the LocalServer using a lambda expression to handle the callback
LocalServer.InitializeAsync(Function()
    ' Check the LocalServer InitializationError property
    If LocalServer.InitializationError IsNot Nothing Then
        ' The LocalServer encountered an error or did not start correctly
        ' ...
        Exit Function
    End If
End Function)

Inheritance Hierarchy

System.Object
   ESRI.ArcGIS.Client.Local.LocalServer

Requirements

Target Platforms: Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family, Windows 7, Windows 8

See Also

© ESRI, Inc. All Rights Reserved.