void SetDeviceLocationOptions( MapDeviceLocationOptions options )
Sub SetDeviceLocationOptions( _ ByVal options As MapDeviceLocationOptions _ )
Parameters
- options
- MapDeviceLocationOptions
void SetDeviceLocationOptions( MapDeviceLocationOptions options )
Sub SetDeviceLocationOptions( _ ByVal options As MapDeviceLocationOptions _ )
{
await 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;
}
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;
//Sets the MapDeviceLocationOptions to be updates with these values
await QueuedTask.Run(() =>
MapDeviceLocationService.Instance.SetDeviceLocationOptions(currentOptions));
}
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)