//TODO: [Enhancement] Avoid async void calls! private async Task LoadMotelsLocations() { IsBusy = true; try { using (UserDialogs.Instance.Loading(Informations.Loading, null, null, true)) { // TODO: Add an activity indicator while loading the information Motels = await _getAllMotels.Invoke(); } } catch (Exception exception) { // TODO: Register Crash and Exceptions into AppCenter Console.WriteLine(exception.Message); var dialogServiceResult = await _dialogService .DisplayAlertAsync ( CommonDisplayAlertMessages.Warning, Messages.Warning.ThereIsAnErrorGettingTheInformationFromTheServer, CommonDisplayAlertMessages.TryAgain, CommonDisplayAlertMessages.No ); if (dialogServiceResult) { await LoadMotelsLocations(); } return; } }
//TODO: [Enhancement] Avoid async void calls! private async void LoadMotelsLocations() { foreach (var item in await _getAllMotels.Invoke()) { var pinItem = new Pin { Position = new Position(item.Latitude, item.Longitude), Icon = BitmapDescriptorFactory.FromBundle(markerIcon), Label = item.Name, Address = addressLabel }; //TODO: [Enhancement] Map from Domain to UI Model using AutoMapper Locations.Add(new MotelLocation { Pin = pinItem, Motel = item }); Pins.Add(pinItem); } }