예제 #1
0
        async Task ExecuteLoadProductItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                ProductItems.Clear();
                //var items = await restService.GetResponse<List<Product>>(Constants.urlApi + "manufacturers/" + manufacturerId + "/products", true);
                var items = await App.QuoteProductDatabase.GetProductItemsAsync();

                ProductItems = new ObservableCollection <ProductItem>(items);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
예제 #2
0
        async Task ExecuteRefreshCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                var orders = await _service.GetProducts();

                ProductItems.Clear();
                foreach (var todo in orders)
                {
                    ProductItems.Add(todo);
                }
            }
            catch (Exception ex)
            {
                Acr.UserDialogs.UserDialogs.Instance.ShowError(ex.Message);
            }
            finally
            {
                IsBusy = false;
            }
        }
예제 #3
0
 public void Init()
 {
     ProductItems.Clear();
     ProductItems.Add(new ProductItem
     {
         Name             = "iPhone 7 Plus 太空金",
         price            = 28000,
         number           = 2,
         UpdateSumCommand = new DelegateCommand(CalculateSum),
     });
     ProductItems.Add(new ProductItem
     {
         Name             = "60天世界旅遊一周",
         price            = 168168,
         number           = 1,
         UpdateSumCommand = new DelegateCommand(CalculateSum),
     });
     ProductItems.Add(new ProductItem
     {
         Name             = "32\"重乳酪起司",
         price            = 742,
         number           = 2,
         UpdateSumCommand = new DelegateCommand(CalculateSum),
     });
     ProductItems.Add(new ProductItem
     {
         Name             = "海港自助餐劵",
         price            = 468,
         number           = 8,
         UpdateSumCommand = new DelegateCommand(CalculateSum),
     });
 }