public PurchaseOptions(DiningRoomGUI parent, int startX, string[] opts, string type) { for (int i = 0; i < opts.Length; i++) { Label text = new Label(); text.Tag = type; text.Parent = parent; text.Text = opts[i]; text.BorderStyle = BorderStyle.FixedSingle; text.Font = new Font("Arial", 14, FontStyle.Bold); text.BackColor = Color.SkyBlue; text.Location = new Point(startX, 25 + 40 * i); text.AutoSize = true; Button button = new Button(); button.Text = "+"; button.Parent = parent; button.BackColor = Color.SkyBlue; button.Location = new Point(startX + text.Width + 10, 25 + 40 * i); button.Size = new Size(20, 20); button.Tag = text; button.Click += new EventHandler(parent.ButtonClick); parent.Controls.Add(button); Button button2 = new Button(); button2.Text = "-"; button2.Parent = parent; button2.BackColor = Color.SkyBlue; button2.Location = new Point(startX + text.Width + button.Width + 10, 25 + 40 * i); button2.Size = new Size(20, 20); button2.Tag = text; button2.Click += new EventHandler(parent.ButtonClick); parent.Controls.Add(button2); } }
public Tables(DiningRoomGUI parent, int startY, int numTables) { for (int i = 0; i < numTables; i++) { CheckBox checkBox1 = new CheckBox(); checkBox1.Appearance = Appearance.Button; checkBox1.Text = "Table " + (i + 1).ToString(); checkBox1.Parent = parent; checkBox1.Click += new EventHandler(this.checkBoxHandler); checkBox1.Size = new Size(40, 40); checkBox1.Location = new Point(25 + 50 * i, startY); checkBox1.BackColor = Color.SkyBlue; parent.Controls.Add(checkBox1); } }
private void checkBoxHandler(object sender, EventArgs e) { CheckBox check = sender as CheckBox; DiningRoomGUI parent = check.Parent as DiningRoomGUI; if (ticked != null) { ticked.Checked = false; check.Checked = true; ticked = check; } else { ticked = check; check.Checked = true; } parent.Table = check.Text.Split(" ")[1]; parent.updateOrderTotal(parent.orderTotal.getTotal()); }
public void setupComponents(DiningRoomGUI parent) { Label text = new Label(); text.Text = "Orders Not Picked"; text.Parent = parent; text.BorderStyle = BorderStyle.FixedSingle; text.Font = new Font("Arial", 14, FontStyle.Bold); text.BackColor = Color.SkyBlue; text.Location = new Point(this.x, this.y); text.AutoSize = true; parent.Controls.Add(text); parent.controls.Add(text); int i = 0; foreach (KeyValuePair <int, string> item in this.orderPartsReady) { Label order = new Label(); order.Tag = item.Key; order.Parent = parent; order.Text = item.Key + " : " + item.Value; order.BorderStyle = BorderStyle.FixedSingle; order.Font = new Font("Arial", 14, FontStyle.Bold); order.BackColor = Color.SkyBlue; order.Location = new Point(this.x, this.y + text.Height * (i + 1) + 10); order.AutoSize = true; parent.Controls.Add(order); parent.controls.Add(order); Button button = new Button(); button.Parent = parent; button.Text = "Serve"; button.BackColor = Color.SkyBlue; button.Location = new Point(this.x + order.Width + 10, this.y + text.Height * (i + 1) + 10); button.Size = new Size(40, 20); button.Tag = order; button.Click += new EventHandler(parent.servedOrder); parent.Controls.Add(button); parent.controls.Add(button); i++; } }
public OrderTotal(DiningRoomGUI parent, int startY) { this.text = new Label(); this.text.Parent = parent; this.text.Text = "Order Total : 0€:"; this.text.BorderStyle = BorderStyle.FixedSingle; this.text.Font = new Font("Arial", 14, FontStyle.Bold); this.text.BackColor = Color.SkyBlue; this.text.Location = new Point(25, startY); this.text.AutoSize = true; Button button = new Button(); button.Text = "Make Order"; button.Parent = parent; button.BackColor = Color.SkyBlue; button.Location = new Point(25, startY + this.text.Height + 10); button.Size = new Size(70, 40); button.Click += new EventHandler(parent.MakeOrder); parent.Controls.Add(button); }