public void SetDeviceLocationOptions( MapDeviceLocationOptions options )
Public Sub SetDeviceLocationOptions( _ ByVal options As MapDeviceLocationOptions _ )
Parameters
- options
- A MapDeviceLocationOptions
public void SetDeviceLocationOptions( MapDeviceLocationOptions options )
Public Sub SetDeviceLocationOptions( _ ByVal options As MapDeviceLocationOptions _ )
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 |
//Must be on the QueuedTask.Run() //Check there is a source first... if (DeviceLocationService.Instance.GetSource() == null) //Setting DeviceLocationOptions w/ no Device Location Source //Will throw an InvalidOperationException return; var map = MapView.Active.Map; 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 });
var currentOptions = MapDeviceLocationService.Instance.GetDeviceLocationOptions(); if (currentOptions == null) return; currentOptions.DeviceLocationVisibility = true; currentOptions.NavigationMode = MappingDeviceLocationNavigationMode.KeepAtCenter; await QueuedTask.Run(() => { MapDeviceLocationService.Instance.SetDeviceLocationOptions(currentOptions); });
Target Platforms: Windows 11, Windows 10