Пример #1
0
        private void AfterTextChanged(object sender, AfterTextChangedEventArgs eventArgs)
        {
            var editText = (EditText)sender;
            var text     = eventArgs.Editable.ToString();

            if (editText.Id == AddInvoiceCity.Id)
            {
                var token = CancelAndSetTokenForView(AddInvoiceCity);

                Criteria.Name = text;

                var task = Task.Run(async() =>
                {
                    var cityResult = await CityService.GetCities(Criteria, token);

                    RunOnUiThread(() =>
                    {
                        _cityAdapter.UpdateList(cityResult.Data);
                    });
                }, token);
            }
            if (editText.Id == AddInvoiceCounterparty.Id)
            {
                var token = CancelAndSetTokenForView(AddInvoiceCounterparty);

                Criteria.Name = text;

                var task = Task.Run(async() =>
                {
                    var counterpartyResult = await CounterpartyService.GetCounterparties(Criteria, token);

                    RunOnUiThread(() =>
                    {
                        _counterPartyAdapter.UpdateList(counterpartyResult.Data);
                    });
                }, token);
            }
        }
        public async Task GetCities()
        {
            var result = await CityService.GetCities(Criteria);

            Activity.RunOnUiThread(() =>
            {
                if (result.Error.Any())
                {
                    ShowToastMessage("An error occurred");

                    return;
                }

                _cityAdapter.UpdateList(result.Data);
            });
        }
Пример #3
0
        public async Task GetInvoices(CancellationToken token)
        {
            var result = await InvoiceService.GetInvoices(InvoiceFilterCriteria, token);

            RunOnUiThread(() =>
            {
                if (result.Error.Any())
                {
                    ShowToastMessage("An error occurred");

                    return;
                }

                _invoiceAdapter.UpdateList(result.Data);
            });
        }
        public async Task GetCities()
        {
            var result = await CityService.GetCities(Criteria);

            RunOnUiThread(() =>
            {
                if (result.Error.Any())
                {
                    ShowToastMessage(Resource.String.ErrorOccurred);

                    return;
                }

                _cityAdapter.UpdateList(result.Data);
            });
        }