//private void tabControlMain_SelectedIndexChanged(object sender, EventArgs e) //{ // if (tabControlMain.SelectedIndex != 2) // { // labelDeviceSettingStatus.Text = ""; // } //} private void textBoxSNA_TextChanged(object sender, EventArgs e) { if (textBoxSNA.Text.Length == SERIAL_NUMBER_LENGTH) { string serialNumber = textBoxSNA.Text; string partType = serialNumber.Substring(0, PARTNUMBER_LENGTH); string identifier = serialNumber.Substring(PARTNUMBER_LENGTH, (SERIAL_NUMBER_LENGTH - PARTNUMBER_LENGTH)); serialNumber = partType + identifier; //check if serial number is valid if (!validateSerialNumber(serialNumber)) { MessageBox.Show("invalid serial number", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Set_TextBox(textBoxMPNA, ""); Set_TextBox(textBoxSNA, ""); return; } Set_TextBox(textBoxMPNA, partType); Set_TextBox(textBoxSNA, identifier); //Go to Produciton Mode. if (toolStripMenuItemEMode.Checked) { toolStripMenuItemEMode.CheckState = CheckState.Unchecked; toolStripMenuItemPMode.CheckState = CheckState.Checked; } //Check test hardware if (!testHardwareReady) { MessageBox.Show("Hardware is not ready, check hardware config", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Set_TextBox(textBoxMPNA, ""); Set_TextBox(textBoxSNA, ""); return; } if (!testWellARunning) { try { if (lastPartType != partType) { FormTrackpadConfig formTPConfig = new FormTrackpadConfig(); tpConfig = formTPConfig.read(partType); } lastPartType = partType; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error: ", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("No such config file in the folder", "Error: ", MessageBoxButtons.OK, MessageBoxIcon.Error); Log.error(ex.Message); return; } testWellARunning = true; Set_StatusBox(textBoxWellAStatus, "", Color.White); testWellA = new TestWell(agilentDevice, mpqDevice, serialNumber, tpConfig); Thread testThread1 = new Thread(testProcess); testThread1.Start(testWellA); } else { MessageBox.Show("Current Well is in testing...", "Error:", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void exitTPT() { try { RegistryKey saveKey = Registry.LocalMachine.CreateSubKey(@"software\Cypress\TrackpadTest"); saveKey.SetValue("Total Tested", totalTestedNumber.ToString()); saveKey.SetValue("Total Failed", totalFailedNumber.ToString()); saveKey.SetValue("Yield Rate", yieldRate.ToString()); saveKey.SetValue("Test ID", testID); saveKey.SetValue("Test Station", testStation); saveKey.SetValue("Test Site", testSite); agilentDevice = null; mpqDevice = null; testWellA = null; GC.Collect(0); System.Threading.Thread.Sleep(100); } catch(Exception ex) { Log.error(ex.Message); } }
//****************************************// // User Interface // //****************************************// private void Show_Test_Result(TestWell tW, bool testFinished) { //testWellARunning = !testFinished; int i = 0; foreach (TextBox tb in dutTextBoxWellA) { int errorCode = tW.DUTArray[i].ErrorCode; SetDUTTextBox(tb, errorCode, testFinished); i++; } }
//private void tabControlMain_SelectedIndexChanged(object sender, EventArgs e) //{ // if (tabControlMain.SelectedIndex != 2) // { // labelDeviceSettingStatus.Text = ""; // } //} private void textBoxSNA_TextChanged(object sender, EventArgs e) { if (textBoxSNA.Text.Length == SERIAL_NUMBER_LENGTH) { string serialNumber = textBoxSNA.Text; //Go to Produciton Mode First. if (toolStripMenuItemEMode.Checked) { toolStripMenuItemEMode.CheckState = CheckState.Unchecked; toolStripMenuItemPMode.CheckState = CheckState.Checked; } //Check test parameter setting DeviceConfig.partType = serialNumber.Substring(0, PARTNUMBER_LENGTH); //DeviceConfig.filePath = Application.StartupPath + "\\Production.ini"; if (!DeviceConfig.Read()) { MessageBox.Show("Cannot find " + DeviceConfig.partType.ToString() + " in Production.ini", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Set_TextBox(textBoxMPNA, ""); Set_TextBox(textBoxSNA, ""); return; } //Check test hardware if (!testHardwareReady) { MessageBox.Show("Hardware is not ready, check hardware config", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Set_TextBox(textBoxMPNA, ""); Set_TextBox(textBoxSNA, ""); //SettingLoad(); return; } if (!testWellARunning) { testWellARunning = true; Set_StatusBox(textBoxWellAStatus, "", Color.White); Set_TextBox(textBoxMPNA, DeviceConfig.partType); Set_TextBox(textBoxSNA, serialNumber.Substring(PARTNUMBER_LENGTH + 1, (SERIAL_NUMBER_LENGTH - PARTNUMBER_LENGTH-1))); //SettingLoad(); testWellA = new TestWell(agilentDevice, mpqDevice, serialNumber); Thread testThread1 = new Thread(testProcess); testThread1.Start(testWellA); } else MessageBox.Show("Current Well is in testing...", "Error:", MessageBoxButtons.OK, MessageBoxIcon.Error); } }