Beispiel #1
0
        void OrderList(string orderBy)
        {
            _dialogService.ShowLoading("Reordenando");

            try
            {
                if (orderBy.Equals(EnumOrderType.Preco.GetDescription()))
                {
                    Imoveis = new ObservableCollection <Imovei>(Imoveis.OrderByDescending(x => x.PrecoVenda));
                }
                if (orderBy.Equals(EnumOrderType.Dormitorios.GetDescription()))
                {
                    Imoveis = new ObservableCollection <Imovei>(Imoveis.OrderByDescending(x => x.Dormitorios));
                }
                if (orderBy.Equals(EnumOrderType.Suites.GetDescription()))
                {
                    Imoveis = new ObservableCollection <Imovei>(Imoveis.OrderByDescending(x => x.Suites));
                }
                if (orderBy.Equals(EnumOrderType.Vagas.GetDescription()))
                {
                    Imoveis = new ObservableCollection <Imovei>(Imoveis.OrderByDescending(x => x.Vagas));
                }
                if (orderBy.Equals(EnumOrderType.AreaTotal.GetDescription()))
                {
                    Imoveis = new ObservableCollection <Imovei>(Imoveis.OrderByDescending(x => x.AreaTotal));
                }

                _dialogService.HideLoading();
            }
            catch (Exception ex)
            {
                _dialogService.ShowToast(EnumToastType.Error, ex.Message);
                _dialogService.HideLoading();
            }
        }
Beispiel #2
0
        public async void OnNavigatedFrom(NavigationParameters parameters)
        {
            if (parameters.ContainsKey("imovelId"))
            {
                ImovelId = (int)parameters["imovelId"];
            }

            if (ImovelId > 0)
            {
                await SetData();
            }
            else
            {
                _dialogService.ShowToast(EnumToastType.Error, Constants.ErrorFetchAPIData, 8000);
            }
        }
Beispiel #3
0
        async Task GetData()
        {
            var policy = Policy
                         .Handle <Exception>()
                         .FallbackAsync(async(Task) => _dialogService.ShowToast(EnumToastType.Error, Constants.GeneralError));

            await policy.ExecuteAsync(async() => { await SetData(); });
        }