public async void GetBreweries(string beerId)
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;


            BaseListResponse <Brewery> response = await RestDataService.GetBreweriesList(beerId);

            if (string.IsNullOrEmpty(response.ErrorMessage))
            {
                Items.Clear();
                List <Brewery> items = response.Data;
                foreach (var item in items)
                {
                    Items.Add(item);
                }
            }
            else
            {
                ShowErrorConection(response.ErrorMessage);
            }

            IsBusy = false;
        }
Beispiel #2
0
        public static void Main(string[] args)
        {
            var restApi        = new RestDataService();
            var conf           = new ConfigurationService();
            var productService = new ProductService(restApi, conf);
            var task           = productService.GetAll();

            Task.WaitAll(task);
            var product = task.Result;
        }
        private async void ExecuteLoadBeersCommand(bool TryRefresh)
        {
            if (IsBusy || IsRrefresh)
            {
                return;
            }

            if (TryRefresh)
            {
                IsRrefresh = true;
            }
            else
            {
                IsBusy = true;
            }


            BaseListResponse <Beer> response = await RestDataService.GetBeerList();

            if (string.IsNullOrEmpty(response.ErrorMessage))
            {
                Items.Clear();
                List <Beer> items = response.Data;
                foreach (var item in items)
                {
                    item.Visited = SettingsService.BeerWasVisited(item.Id);
                    Items.Add(item);
                }
            }
            else
            {
                ShowErrorConection(response.ErrorMessage);
            }


            IsRrefresh = false;
            IsBusy     = false;
        }