private async void SelectStreet(StreetViewModel streetViewModel) { if (_availableCommands == null) { _availableCommands = GetAvailableCommands().ToArray(); } if (!_availableCommands.Any()) { await Application.Current.MainPage.DisplayAlert("Ой", "Установите яндекс навигатор или карту.", null); return; } var result = await Application.Current.MainPage.DisplayActionSheet(streetViewModel.Name, "Назад", null, _availableCommands.Select(command => command.Name).ToArray()); var selectedCommand = _availableCommands.FirstOrDefault(command => command.Name == result); selectedCommand?.Execute(streetViewModel); }
public void Execute(StreetViewModel street) { _action.Invoke(street); }