private void LoadProperties() { if (IsBusy) { return; } IsBusy = true; PropertiesCollection.Clear(); try { var properties = Repository.GetProperties(); var items = new List <PropertyListItemViewModel>(); foreach (var property in properties) { var item = new PropertyListItemViewModel(property); if (_currentLocation != null) { item.DistanceInKilometres = _currentLocation.CalculateDistance(property.Latitude, property.Longitude, DistanceUnits.Kilometers); } items.Add(item); } foreach (var item in items.OrderBy(x => x.DistanceInKilometres)) { PropertiesCollection.Add(item); } } finally { IsBusy = false; } }
private async void SelectPropertyAsync(PropertyListItemViewModel item) { await NavigationService.NavigateToAsync <PropertyDetailViewModel>(item.Property); }