Exemplo n.º 1
0
        private async Task LoadMorePropertiesAsync(SearchPropertyResult searchPropertyResult)
        {
            if (searchPropertyResult == null)
            {
                return;
            }

            if (PropertiesList[PropertiesList.Count - 1] == searchPropertyResult && _hasNextPage)
            {
                await Task.Delay(1000);//Only required to be able to view ActivityIndicator in the footer.

                LoadingNextPage = true;
            }

            if (LoadingNextPage == true)
            {
                var result = await _searchService.FindProperties(_locationPrompt, _toLet, _currentPage + 1);

                _currentPage = result.MetaData.PageNumber;
                _hasNextPage = result.MetaData.HasNextPage;

                foreach (var property in result.Properties)
                {
                    PropertiesList.Add(property);
                }

                UpdateDisplyingDescription();

                LoadingNextPage = false;
            }
        }
        private async Task ShowPropertyDetailsAsync(SearchPropertyResult searchPropertyResult)
        {
            if (searchPropertyResult == null)
            {
                return;
            }
            await _navigationService.Navigate <PropertyDetailsViewModel, int>(searchPropertyResult.Id);

            SelectedProperty = null;
        }
Exemplo n.º 3
0
        private async Task LoadMorePropertiesAsync(SearchPropertyResult searchPropertyResult)
        {
            if (searchPropertyResult == null)
            {
                return;
            }

            if (PropertiesList[PropertiesList.Count - 1] == searchPropertyResult)
            {
                //Load more properties if any
            }
        }
        private async Task LoadMorePropertiesAsync(SearchPropertyResult searchPropertyResult)
        {
            if (searchPropertyResult == null)
            {
                return;
            }

            if (PropertiesList[PropertiesList.Count - 1] == searchPropertyResult)
            {
                if (_hasNextPage)
                {
                    try
                    {
                        IsBusy = true;
                        var result = await _searchService.FindProperties(_navigationParams.location, _navigationParams.toLet, _currentPage + 1);

                        _currentPage = result.MetaData.PageNumber;
                        _hasNextPage = result.MetaData.HasNextPage;
                        _total       = result.MetaData.TotalItemCount;

                        foreach (var property in result.Properties)
                        {
                            PropertiesList.Add(property);
                        }

                        UpdateDisplyingDescription();
                    }
                    catch (Exception exc)
                    {
                        _log.ErrorException("An error has occurred while trying to get more results", exc);
                        await _useDialogs.AlertAsync("An error has occurred. Please try again.");
                    }
                    finally
                    {
                        IsBusy = false;
                    }
                }
            }
        }