/* Event Handler for Start Button: * Validate if Server Name and Table Number is entered or not * if Yes, GUI changes will be made*/ private void Button_Start_Click(object sender, EventArgs e) { if (TextBox_Server_Name.Text == "") { MessageBox.Show("Please enter server name before taking order.", "Server Name Required", MessageBoxButtons.OK, MessageBoxIcon.Error); TextBox_Server_Name.Focus(); } else if (TextBox_Table_No.Text == "") { MessageBox.Show("Please enter table number before taking order.", "Table Name Required", MessageBoxButtons.OK, MessageBoxIcon.Error); TextBox_Table_No.Focus(); } else { //Defaulting Pizza Quantity textboxes to 0 TextBox_Pizza1_Quantity.Text = TextBox_Pizza2_Quantity.Text = TextBox_Pizza3_Quantity.Text = "0"; //Displaying Sult Logo at bottom Picture_Sult_Logo.Visible = true; //Hiding Sult Title Picture located at top Picture_Sult_Panel.Visible = false; //Current Panel will be getting hidden Panel_Start.Visible = false; //Pizza Menu Will be shown along with Multiple Buttons Panel, Location will be taken from Sult Title Picture GroupBox_Pizza_Menu.Location = new Point(Picture_Sult_Panel.Location.X, Picture_Sult_Panel.Location.Y); GroupBox_Pizza_Menu.Visible = true; //Button such as Order, Clear will be shown as part of Panel, Location will be dynamically calculated from Pizza Menu Panel_Controls.Location = new Point(GroupBox_Pizza_Menu.Location.X, (GroupBox_Pizza_Menu.Location.Y + GroupBox_Pizza_Menu.Size.Height + 4)); Panel_Controls.Visible = true; //Pizza 1 Quantity will have the focus TextBox_Pizza1_Quantity.Focus(); //Form Title will be changed MainForm.ActiveForm.Text = TextBox_Server_Name.Text + " @ Table Number " + TextBox_Table_No.Text; } }
/* Event Handler For Clear Button: * Clearing all the quantity textboxes and defaulting them to 0 * Clearing the Server Name and Table Number * Clearing Summary Textboxes */ private void Button_Clear_Click(object sender, EventArgs e) { toolTip1.Hide(Button_Clear); toolTip1.Hide(Button_Exit); GroupBox_Pizza_Menu.Visible = false; Panel_Controls.Visible = false; GroupBox_Table_Order.Visible = false; GroupBox_Company_Summary.Visible = false; Panel_Start.Visible = true; Picture_Sult_Panel.Visible = true; Picture_Sult_Logo.Visible = false; Button_Order.Enabled = true; GroupBox_Pizza_Menu.Enabled = true; //Reverting Title of the Form MainForm.ActiveForm.Text = "Welcome to Sult"; TextBox_Server_Name.Text = TextBox_Table_No.Text = ""; TextBox_Pizza1_Quantity.Text = TextBox_Pizza2_Quantity.Text = TextBox_Pizza3_Quantity.Text = "0"; TextBox_summary_name.Text = TextBox_summary_pizza.Text = TextBox_summary_receipt.Text = ""; //Setting Input focus on Server Name TextBox_Server_Name.Focus(); }