public async Task ExecuteLoadItemsCommand() { if (IsBusy) { return; } IsBusy = true; try { ApiService _apiService = new ApiService(); LstItems = new ObservableCollection <RequestSpecs>(); lstItemsShow = new ObservableCollection <RequestSpecs>(); LstItems = await _apiService.GetRequestsAsync(email, Status, "", ""); foreach (RequestSpecs item in LstItems) { item.CountryCodeFrom = item.CountryCodeFrom + " - " + ProvideCountries.GetCountryName(item.CountryCodeFrom); item.CountryCodeTo = item.CountryCodeTo + " - " + ProvideCountries.GetCountryName(item.CountryCodeTo); item.imageSource = ImageManager.BytesToImage(item.ProductImage); LstItemsShow.Add(item); } } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
public async Task ExecuteLoadItemsCommand() { if (IsBusy) { return; } IsBusy = true; try { App.WaitScreenStart(Translator.getText("Loading")); ApiService _apiService = new ApiService(); LstItems = new ObservableCollection <RequestSpecs>(); lstItemsShow = new ObservableCollection <ShowRequestSpecs>(); LstItems = await _apiService.GetRequestsAsync(email, Status, "", ""); foreach (RequestSpecs item in LstItems) { item.CountryCodeFrom = item.CountryCodeFrom + " - " + ProvideCountries.GetCountryName(item.CountryCodeFrom); item.CountryCodeTo = item.CountryCodeTo + " - " + ProvideCountries.GetCountryName(item.CountryCodeTo); item.imageSource = ImageManager.BytesToImage(item.ProductImage); ShowImage = (item.DeliveredAt == "1") ? true : false; sts = new ShowRequestSpecs(); sts.requestSpecs = new RequestSpecs(); sts.requestSpecs = item; sts.imageShow = ShowImage; LstItemsShow.Add(sts); } IsBusy = false; } catch (Exception ex) { Debug.WriteLine(ex); } finally { App.WaitScreenStop(); IsBusy = false; } }
private async Task InitializeAsync(string sEmail) { //using (UserDialogs.Instance.Loading(Translator.getText("Loading"), null, null, true, MaskType.Black)) { ApiService _apiService = new ApiService(); LstItems = new ObservableCollection <RequestSpecs>(); lstItemsShow = new ObservableCollection <RequestSpecs>(); LstItems = await _apiService.GetRequestsAsync(email, Status, "", ""); foreach (RequestSpecs item in LstItems) { item.CountryCodeFrom = item.CountryCodeFrom + " - " + ProvideCountries.GetCountryName(item.CountryCodeFrom); item.CountryCodeTo = item.CountryCodeTo + " - " + ProvideCountries.GetCountryName(item.CountryCodeTo); item.imageSource = ImageManager.BytesToImage(item.ProductImage); LstItemsShow.Add(item); } } }