public void RegisterBuildings(List <Building> buildings) { if (Buildings.Count >= _maximumCapacity) { System.Console.WriteLine("This city is at maximum capacity!"); } else { Buildings.AddRange(buildings); } }
private async Task GetBuildings(bool forceCloud = false) { using (var dlg = this.Dialogs.Loading("Progress (No Cancel)")) { Buildings.Clear(); try { var result = await _buildingsService.GetAllBuildings(EstateId, forceCloud); if (!result.Success) { Dialogs.Toast(result.Message); return; } var buildings = result.ResultObject as IEnumerable <BuildingRow>; if (buildings != null && buildings.Any()) { Buildings.AddRange(buildings); } } catch (ServiceAuthenticationException e) { var result = await TryToLogin(); if (!result) { await NavigationService.NavigateToAsync <LoginViewModel>(); } else { await GetBuildings(forceCloud); } } catch (Exception e) { await ShowErrorAlert(e.Message); } } }
//overloaded method below -- allows to pass in more than one building at a time public void RegisterBuildings(List <Building> buildings) { Buildings.AddRange(buildings); }