private async void SetAreas() { try { IsBusy = true; var locations = await _mountainWeatherService.GetAreas(); if (locations == null) { return; } Areas = locations .Select(location => _areaViewModelFactory(location)) .ToList(); } catch (Exception ex) { Action action = async() => { var result = await _dialogProvider.DisplayActionSheet(ex.Message, "Cancel", null, "Retry"); if (result == "Retry") { SetAreas(); } }; action(); } finally { IsBusy = false; } }
private async void ShowError() { if (_error == null) { return; } var result = await _dialogProvider.DisplayActionSheet(_error.Message, "Cancel", null, "Retry"); _error = null; if (result == "Retry") { LoadForecast(); } }
public async void ShowActionSheet() { var chosenOption = await _dialogProvider.DisplayActionSheet("ActionSheet example", "Cancel", null, "Foo", "Bar", "Qux"); LatestAction = $"Showed an action sheet and choosed {chosenOption}"; }