private void button13_Click(object sender, EventArgs e) { if (!da_li_je_na_listi(9)) { orderPanel.BringToFront(); racun_ukupno = racun_ukupno + 20; order_class a = new order_class(bunifuCustomLabel42.Text, pictureBox14.Image, 20); a.id = 9; article article1 = new article(a, flowLayoutPanel2, azuriraj_racun); flowLayoutPanel2.Controls.Add(article1); price_to_pay_label.Text = Convert.ToString(racun_ukupno); Lista_narudzbi.Add(a); artikli.Add(article1); } else { for (int i = 0; i < Lista_narudzbi.Count; i++) { if (Lista_narudzbi[i].id == 9) { Lista_narudzbi[i].kolicina++; break; } } osvjezi_listu_narudzbi(); } if (!orderPanel.Visible) { tshow.ShowSync(orderPanel); } }
public article(order_class a, FlowLayoutPanel flowLayoutPanel2, Action <int> _azuriraj_racun) { InitializeComponent(); this.a = a; this.flowLayoutPanel2 = flowLayoutPanel2; this.azuriraj_racun = _azuriraj_racun; kolicina = a.kolicina; pictureBox1.BackgroundImage = a.slika; pictureBox1.BackgroundImageLayout = ImageLayout.Stretch; label2.Text = Convert.ToString(a.cijena); label4.Text = Convert.ToString(kolicina); label3.Text = a.naziv; }