Esempio n. 1
0
        private void SetItemList()
        {
            if (shownOrdersList.Count == 0)
            {
                EmptyOrderLabel.Show();
            }
            else
            {
                EmptyOrderLabel.Hide();
            }
            int index = 0;

            foreach (Order order in shownOrdersList)
            {
                string          orderId  = order.Id.ToString();
                FlowLayoutPanel flowItem = new FlowLayoutPanel
                {
                    FlowDirection = FlowDirection.LeftToRight
                };
                Btn btnByProduct = new Btn
                {
                    Width  = 50,
                    Height = 35,
                    Order  = order,
                    Text   = "Asignar"
                };
                Btn btnDeleteOrder = new Btn
                {
                    Width  = 50,
                    Height = 35,
                    Order  = order,
                    Text   = "Delete",
                    Index  = index
                };
                Btn btnPrint = new Btn
                {
                    Width  = 50,
                    Height = 35,
                    Order  = order,
                    Text   = "Print",
                    Index  = index
                };
                btnDeleteOrder.Click += BtnDeleteOrder_Click;
                btnByProduct.Click   += BtnByProduct_Click;
                btnPrint.Click       += BtnPrint_Click;
                Label info = new Label
                {
                    Text   = $"Order N° {orderId}",
                    Width  = 80,
                    Height = 40,
                    Font   = new System.Drawing.Font("Arial Narrow", 12, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)))
                };

                flowItem.Height = 40;
                flowItem.Width  = Panel.Width;
                flowItem.Name   = orderId;
                flowItem.Controls.Add(info);
                flowItem.Controls.Add(btnByProduct);
                flowItem.Controls.Add(btnDeleteOrder);
                flowItem.Controls.Add(btnPrint);
                Panel.Controls.Add(flowItem);
                index++;
            }
        }