/******************************************************************************************************************** * * [User Interface] * * Buttons * ******************************************************************************************************************** ******************************************************************************************************************** * [Buttons] * * -----------------------------------------------------[Enter]------------------------------------------------------ * -- * * ------------------------------------------------------[Run]------------------------------------------------------- * -- * * ---------------------------------------------------- [Cancel]----------------------------------------------------- * --Global Variables: * JobFound = false; * ********************************************************************************************************************/ private void Enter_Button_Click(object sender, EventArgs e) { try { QuantityOfParts = Int32.Parse(PartsNeeded_TextBox.Text); if (QuantityOfParts >= 1) { PartsNeeded_TextBox.ReadOnly = true; Enter_Button.Enabled = false; Enter_Button.Visible = false; ShowComponents(); Scan_TextBox.Focus(); Scan_ListBox.Items.Clear(); Scan_ListBox.Items.Add("Please Scan In Components Needed"); } else if (QuantityOfParts == 0) { MessageBox.Show("Please Enter a Value Greater Than 0"); } } catch { MessageBox.Show("Please Enter a Value Greater Than 0"); } }
private void Enter_Button_Click(object sender, EventArgs e) { try { JobData_ListBox.Items.Clear(); PartsNeeded_TextBox.ReadOnly = true; Enter_Button.Enabled = false; QuantityOfParts = Int32.Parse(PartsNeeded_TextBox.Text); if (QuantityOfParts >= 1) { ShowFormData(); if (Fixture_TextBox.Text != "N/A") { Scan_TextBox.Focus(); JobData_ListBox.Items.Add("Please Scan Fixture"); } else if (Fixture_TextBox.Text == "N/A") { Run_Button.Show(); Run_Button.Focus(); JobData_ListBox.Items.Add("No Fixture For Item"); } } else if (QuantityOfParts == 0) { MessageBox.Show("Please Enter a Value Greater Than 0"); } } catch { MessageBox.Show("Please Enter a Value Greater Than 0"); } }
private void FixtureLocation_TextBox_Enter(object sender, EventArgs e) { if (Scan_TextBox.Visible == true && Run_Button.Visible == false) { Scan_TextBox.Focus(); } else if (Scan_TextBox.Visible == false && Run_Button.Visible == true) { Run_Button.Focus(); } }
/********************************************************************************************************************* * * Methods Region End * *********************************************************************************************************************/ #endregion /********************************************************************************************************************* * * Events Region Start * *********************************************************************************************************************/ #region private void PartsNeeded_TextBox_Enter(object sender, EventArgs e) { if (PartsNeeded_TextBox.ReadOnly == true && Scan_TextBox.Visible == true) { Scan_TextBox.Focus(); } else if (PartsNeeded_TextBox.ReadOnly == true && Run_Button.Visible == true) { Run_Button.Focus(); } }
/******************************************************************************************************************** * * Variables In Testing Start * ********************************************************************************************************************/ private void ShowFormData() { JobData_ListBox.Show(); Fixture_Label.Show(); Fixture_TextBox.Show(); FixtureLocation_Label.Show(); FixtureLocation_TextBox.Show(); //_Label.Show(); Fixture_TextBox.Show(); FixtureLocation_Label.Show(); FixtureLocation_TextBox.Show(); Scan_Label.Show(); Scan_TextBox.Show(); }
private void Scan_ListBox_Enter(object sender, EventArgs e) { if (Scan_TextBox.Visible == true && Run_Button.Visible == false) { Scan_TextBox.Focus(); } else if (Scan_TextBox.Visible == false && Run_Button.Visible == true) { Run_Button.Focus(); } else if (Scan_TextBox.Visible == false && Run_Button.Visible == false) { ReferenceNumber_TextBox.Focus(); } }
private void ItemID_TextBox_Enter(object sender, EventArgs e) { if (Scan_TextBox.Visible == true && Run_Button.Visible == false) { Scan_TextBox.Focus(); } else if (Scan_TextBox.Visible == false && Run_Button.Visible == true) { Run_Button.Focus(); } else if (Scan_TextBox.Visible == false && Run_Button.Visible == false) { Enter_Button.Focus(); } }
private void ScanFixture() { if (ScannerString == Fixture_TextBox.Text) { JobData_ListBox.Items.Add("Fixture: " + ScannerString + " Scanned" + "\n"); this.Fixture_TextBox.BackColor = Color.Chartreuse; Scan_TextBox.Clear(); Run_Button.Show(); Run_Button.Focus(); Scan_Label.Hide(); Scan_TextBox.Hide(); } else if (ScannerString != Fixture_TextBox.Text) { JobData_ListBox.Items.Add("Scanned Data: " + ScannerString + " Does Not Match"); JobData_ListBox.Items.Add("Scan Fixture Again"); Scan_TextBox.Clear(); } }
// Occurs When The Scan TextBox is Focused on and a Key is Pressed private void Scan_TextBox_KeyDown(object sender, KeyEventArgs e) { // The Barcode Scanner Acts as the Enter Button if (e.KeyCode == Keys.Enter) { ScannerString = Scan_TextBox.Text; // Move Barcode Scanned to ScannerString int StringError; StringError = Regex.Matches(ScannerString, @"[\D]").Count; // Check to see if barcode contains any invalid characters if (ScannerString.Length >= 9 && StringError == 1) { ScanComponents_OPC(); // Write Barcode To PLC ScanItems(); // Check to See if Barcode Scanned Matches any Components } else { Scan_ListBox.Items.Add("Item " + ScannerString + " Was Not a Correct Component or Fixture"); Scan_TextBox.Clear(); } } }
/********************************************************************************************************************* * * Events Region End * *********************************************************************************************************************/ #endregion /********************************************************************************************************************* * * No Longer in Use Region * *********************************************************************************************************************/ #region private void CheckCompletion() { switch (NumberOfComponents) { case 1: // Single Component switch (YesNoFixture) { case 0: // No Fixture if (Comp1Scanned == true && CorrectComponents_TextBox.Text == "True") { Scan_TextBox.Hide(); Run_Button.Show(); //Run_Button.Focus(); //CorrectComponents_Timer.Stop(); } break; case 1: // Yes Fixture if (Comp1Scanned == true && FixtureScanned == true) { Scan_TextBox.Hide(); Run_Button.Show(); Run_Button.Focus(); } break; } break; case 2: // Two Components switch (YesNoFixture) { case 0: // No Fixture if (Comp1Scanned == true && Comp2Scanned == true) { Scan_TextBox.Hide(); Run_Button.Show(); Run_Button.Focus(); } break; case 1: // Yes Fixture if (Comp1Scanned == true && Comp2Scanned == true && FixtureScanned == true) { Scan_TextBox.Hide(); Run_Button.Show(); Run_Button.Focus(); } break; } break; case 3: // Three Components switch (YesNoFixture) { case 0: // No Fixture if (Comp1Scanned == true && Comp2Scanned == true && Comp3Scanned == true) { Scan_TextBox.Hide(); Run_Button.Show(); Run_Button.Focus(); } break; case 1: // Yes Fixture if (Comp1Scanned == true && Comp2Scanned == true && Comp3Scanned == true && FixtureScanned == true) { Scan_TextBox.Hide(); Run_Button.Show(); Run_Button.Focus(); } break; } break; case 4: // Three Components switch (YesNoFixture) { case 0: // No Fixture if (Comp1Scanned == true && Comp2Scanned == true && Comp3Scanned == true && Comp4Scanned == true) { Scan_TextBox.Hide(); Run_Button.Show(); Run_Button.Focus(); } break; case 1: // Yes Fixture if (Comp1Scanned == true && Comp2Scanned == true && Comp3Scanned == true && Comp4Scanned == true && FixtureScanned == true) { Scan_TextBox.Hide(); Run_Button.Show(); Run_Button.Focus(); } break; } break; } }
// Check to See if Barcode Matches any Components private void ScanItems() { if (ScannerString == Comp1_TextBox.Text) { if (Comp1Scan_Label.Visible == false) { Scan_ListBox.Items.Add("Component: " + ScannerString + " Scanned" + "\n"); Comp1Scanned = true; this.Comp1_TextBox.BackColor = Color.Chartreuse; Comp1Scan_Label.Show(); Scan_TextBox.Clear(); } else if (Comp1Scan_Label.Visible == true) { Scan_ListBox.Items.Add("Component: " + ScannerString + " Has Already Been Scanned" + "\n"); Scan_TextBox.Clear(); } } else if (ScannerString == Comp2_TextBox.Text) { if (Comp2Scan_Label.Visible == false) { Scan_ListBox.Items.Add("Component: " + ScannerString + " Scanned" + "\n"); Comp2Scanned = true; this.Comp2_TextBox.BackColor = Color.Chartreuse; Comp2Scan_Label.Show(); Scan_TextBox.Clear(); } else if (Comp2Scan_Label.Visible == true) { Scan_ListBox.Items.Add("Component: " + ScannerString + " Has Already Been Scanned" + "\n"); Scan_TextBox.Clear(); } } else if (ScannerString == Comp3_TextBox.Text) { if (Comp3Scan_Label.Visible == false) { Scan_ListBox.Items.Add("Component: " + ScannerString + " Scanned" + "\n"); Comp3Scanned = true; this.Comp3_TextBox.BackColor = Color.Chartreuse; Comp3Scan_Label.Show(); Scan_TextBox.Clear(); } else if (Comp3Scan_Label.Visible == true) { Scan_ListBox.Items.Add("Component: " + ScannerString + " Has Already Been Scanned" + "\n"); Scan_TextBox.Clear(); } } else if (ScannerString == Comp4_TextBox.Text) { if (Comp4Scan_Label.Visible == false) { Scan_ListBox.Items.Add("Component: " + ScannerString + " Scanned" + "\n"); Comp4Scanned = true; this.Comp4_TextBox.BackColor = Color.Chartreuse; Comp4Scan_Label.Show(); Scan_TextBox.Clear(); } else if (Comp4Scan_Label.Visible == true) { Scan_ListBox.Items.Add("Component: " + ScannerString + " Has Already Been Scanned" + "\n"); Scan_TextBox.Clear(); } } else if (ScannerString == Fixture_TextBox.Text) { if (FixtureScan_Label.Visible == false) { Scan_ListBox.Items.Add("Component: " + ScannerString + " Scanned" + "\n"); FixtureScanned = true; this.Fixture_TextBox.BackColor = Color.Chartreuse; FixtureScan_Label.Show(); Scan_TextBox.Clear(); } else if (FixtureScan_Label.Visible == true) { Scan_ListBox.Items.Add("Fixture: " + ScannerString + " Has Already Been Scanned" + "\n"); Scan_TextBox.Clear(); } } else { Scan_ListBox.Items.Add("Item " + ScannerString + " Was Not a Correct Component or Fixture"); Scan_TextBox.Clear(); } }