async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }
            IsBusy = true;

            Database db = new Database();

            string[,] inventory = db.GetUserInventory();

            try
            {
                Items.Clear();
                var items = await ItemStore.GetItemsAsync(true);

                for (int i = 0; i < inventory.Length; i++)
                {
                    Items.Add(new Item {
                        UPC = inventory[i, 0], ProductName = inventory[i, 1], Description = inventory[i, 2], ImageUrl = inventory[i, 3], Quantity = inventory[i, 4]
                    });
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Ejemplo n.º 2
0
        async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            Debug.WriteLine("Loading items.");

            try
            {
                Items.Clear();
                var items = await ItemStore.GetItemsAsync(true);

                foreach (var item in items)
                {
                    Items.Add(item);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }