private async void OnStartClicked(object sender, EventArgs e)
{
// Show sheet and get title from the selection
var selectedMode =
await DisplayActionSheet("Select navigation mode", "Cancel", null, _navigationTypes);
// If selected cancel do nothing
if (selectedMode == "Cancel") return;
// Get index that is used to get the selected url
var selectedIndex = _navigationTypes.ToList().IndexOf(selectedMode);
switch (selectedIndex)
{
case 0:
// Starts location display with auto pan mode set to Off
MyMapView.LocationDisplay.AutoPanMode = LocationDisplayAutoPanMode.Off;
//TODO Remove this IsStarted check https://github.com/Esri/arcgis-runtime-samples-xamarin/issues/182
if (!MyMapView.LocationDisplay.IsEnabled)
MyMapView.LocationDisplay.IsEnabled = true;
break;
case 1:
// Starts location display with auto pan mode set to Re-center
MyMapView.LocationDisplay.AutoPanMode = LocationDisplayAutoPanMode.Recenter;
//TODO Remove this IsStarted check https://github.com/Esri/arcgis-runtime-samples-xamarin/issues/182
if (!MyMapView.LocationDisplay.IsEnabled)
MyMapView.LocationDisplay.IsEnabled = true;
break;
case 2:
// Starts location display with auto pan mode set to Navigation
MyMapView.LocationDisplay.AutoPanMode = LocationDisplayAutoPanMode.Navigation;
//TODO Remove this IsStarted check https://github.com/Esri/arcgis-runtime-samples-xamarin/issues/182
if (!MyMapView.LocationDisplay.IsEnabled)
MyMapView.LocationDisplay.IsEnabled = true;
break;
case 3:
// Starts location display with auto pan mode set to Compass Navigation
MyMapView.LocationDisplay.AutoPanMode = LocationDisplayAutoPanMode.CompassNavigation;
//TODO Remove this IsStarted check https://github.com/Esri/arcgis-runtime-samples-xamarin/issues/182
if (!MyMapView.LocationDisplay.IsEnabled)
MyMapView.LocationDisplay.IsEnabled = true;
break;
}
}
}