コード例 #1
0
        private void UpdateFields()
        {
            currentUser = serviceClient.GetUserByUsername(UsernameLabel.Text);

            UserMoney.Text = "€ " + currentUser.Money.ToString("0.00");

            List <Inventory>    shopProducts = serviceClient.GetInventory();
            List <UserProducts> userProducts = serviceClient.GetUserProducts(currentUser.UserID);

            UserInventory.Items.Clear();
            ShopInventory.Items.Clear();

            UserInventory.BeginUpdate();

            userProducts.ForEach(product =>
            {
                UserInventory.Items.Add(product.Product.Name + ", Owned: " + product.Amount);
            });

            UserInventory.EndUpdate();

            ShopInventory.BeginUpdate();

            shopProducts.ForEach(product =>
            {
                ListViewItem item = new ListViewItem();
                item.Text         = "€ " + product.Product.Price.ToString("0.00") + " : " + product.Product.Name + ", Amount: " + product.Storage;
                item.Tag          = product.Product.ProductID;
                ShopInventory.Items.Add(item);
            });

            ShopInventory.EndUpdate();
        }