Example #1
0
        protected override void OnResume()
        {
            base.OnResume();

            // If we haven't already loaded the products from the store, do it now
            if (listView.Adapter == null && !isFetching)
            {
                isFetching = true;
                ShowLoadingDialog(Resource.String.loading_data);

                var success = new Action <IEnumerable <Product>, Response>((products, response) =>
                {
                    isFetching = false;
                    DismissLoadingDialog();
                    OnFetchedProducts(products.ToList());
                });

                var failure = new Action <RetrofitError>(error =>
                {
                    isFetching = false;
                    OnError(error);
                });

                if (collectionId != null)
                {
                    SampleApplication.GetProducts(collectionId, success, failure);
                }
                else
                {
                    SampleApplication.GetAllProducts(success, failure);
                }
            }
        }