Public Sub SetDeviceLocationOptions( _ ByVal options As MapDeviceLocationOptions _ )
public void SetDeviceLocationOptions( MapDeviceLocationOptions options )
Parameters
- options
- A MapDeviceLocationOptions
Public Sub SetDeviceLocationOptions( _ ByVal options As MapDeviceLocationOptions _ )
public void SetDeviceLocationOptions( MapDeviceLocationOptions options )
| Exception | Description |
|---|---|
| ArcGIS.Core.CalledOnWrongThreadException | This method or property must be called within the lambda passed to QueuedTask.Run. |
| System.ArgumentNullException | Value cannot be null: options |
| System.InvalidOperationException | The active map view cannot be null |
| System.InvalidOperationException | A DeviceLocationSource must be open |
{
//Note: Run within a QueuedTask
//Check there is a source first...
if (DeviceLocationService.Instance.GetSource() == null)
//Setting DeviceLocationOptions w/ no Device Location Source
//Will throw an InvalidOperationException
return;
if (!MapDeviceLocationService.Instance.IsDeviceLocationEnabled)
//Setting DeviceLocationOptions w/ no Device Location Enabled
//Will throw an InvalidOperationException
return;
MapDeviceLocationService.Instance.SetDeviceLocationOptions(
new MapDeviceLocationOptions()
{
DeviceLocationVisibility = true,
NavigationMode = MappingDeviceLocationNavigationMode.KeepAtCenter,
TrackUpNavigation = true
});
}
{
// Get the MapDeviceLocationOptions currently used by the MapDeviceLocationService
var currentOptions = MapDeviceLocationService.Instance.GetDeviceLocationOptions();
if (currentOptions == null)
return;
// Set the device location visibility on the map to true
currentOptions.DeviceLocationVisibility = true;
//Set the navigation mode to keep the device location at the center of the map
currentOptions.NavigationMode = MappingDeviceLocationNavigationMode.KeepAtCenter;
//Note: Run within a QueuedTask
//Sets the MapDeviceLocationOptions to be updates with these values
MapDeviceLocationService.Instance.SetDeviceLocationOptions(currentOptions);
}
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)