ArcGIS Pro 2.8 API Reference Guide
SetDeviceLocationEnabled Method (MapDeviceLocationService)

ArcGIS.Desktop.Mapping.DeviceLocation Namespace > MapDeviceLocationService Class : SetDeviceLocationEnabled Method
Set to true to enable the current DeviceLocationSource. False to disable.
Enables (or disables) the current DeviceLocationSource. Use ArcGIS.Desktop.Core.DeviceLocation.IDeviceLocationService.Open prior to enabling the DeviceLocationSource. This method must be called on the MCT. Use QueuedTask.Run.
Syntax
public void SetDeviceLocationEnabled( 
   bool enable
)
Public Sub SetDeviceLocationEnabled( _
   ByVal enable As Boolean _
) 

Parameters

enable
Set to true to enable the current DeviceLocationSource. False to disable.
Exceptions
ExceptionDescription
This method or property must be called within the lambda passed to QueuedTask.Run.
The active map view is null.
A DeviceLocationSource must be open.
Remarks
There must be an active map view with an associated map or an System.InvalidOperationException will be thrown.

Set MapDeviceLocationOptions.DeviceLocationVisibility = true to display the location on the map view when the device location source is enabled. Refer to SetDeviceLocationOptions.

Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

MapDeviceLocationService Class
MapDeviceLocationService Members