예제 #1
0
 /* 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;
     }
 }
예제 #2
0
 // Event Handler to validate TextBox Pizza(Margherita) Quantity and display the error message when the user enters invalid for Pizza Quantity
 //if input is invalid, previous pizza quantity will be cleared out and current textbox is highlighted
 private void TextBox_Pizza1_Quantity_Leave(object sender, EventArgs e)
 {
     if (TextBox_Pizza1_Quantity.Text != "")
     {
         if (Check_Char(TextBox_Pizza1_Quantity.Text, 1))
         {
             TextBox_Pizza1_Quantity.Text = "";
             TextBox_Pizza1_Quantity.Focus();
             TextBox_Pizza1_Quantity.SelectAll();
         }
     }
 }