ArcGISRuntimeXamarin.Samples.DisplayDeviceLocation.DisplayDeviceLocation.OnNavigationMenuItemClicked C# (CSharp) Метод

OnNavigationMenuItemClicked() приватный Метод

private OnNavigationMenuItemClicked ( object sender, PopupMenu e ) : void
sender object
e PopupMenu
Результат void
        private void OnNavigationMenuItemClicked(object sender, PopupMenu.MenuItemClickEventArgs e)
        {
            // Get title from the selected item
            var selectedNavigationType = e.Item.TitleCondensedFormatted.ToString();

            // Get index that is used to get the selected url
            var selectedIndex = _navigationTypes.ToList().IndexOf(selectedNavigationType);

            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;
            }
        }