public void setItemFram(itemFrame iF)
 {
     this.iF = iF;
 }
示例#2
0
        //////////////////////////////////////////////////////////////////////////////////////////functions

        public void changePage(List<ProductClass> list, string category, int page)
        {
            VisibilityChanger(0, Visibility.Visible);

            for (int i = 0; i < 10; i++)
                stackPanelList[i].Children.Clear();

            int counter = 0;
            int productCounter = 0;
            int startFrom = page * 10;

            foreach (ProductClass pc in list)
            {
                if (pc.GetCategory().Equals(category) && counter < startFrom) counter++;
                if (pc.GetCategory().Equals(category) && counter >= startFrom)
                {
                    itemFrame iF = new itemFrame(this, iI);
                    iF.nameLabel.Content = pc.getName();
                    iF.priceLabel.Content = pc.getPrice();
                    iF.SetImage(pc.getImage());
                    iF.setIndex(pc.getId());
                    stackPanelList[productCounter].Children.Add(iF);
                    itemFrameList.Add(iF);
                    productCounter++;

                    if (pc.getQuantity() == 0)
                    {
                        iF.button.IsEnabled = false;
                        iI.addButton.IsEnabled = false;
                    }
                    if (productCounter == 10) break;
                }
            }

            VisibilityChanger(productCounter, Visibility.Hidden);

            if (loginTmp == 0)
                hideUnhideAddButton(1);
        }