//****************************************// // Menu Strip // //****************************************// private void deviceConfigToolStripMenuItem_Click(object sender, EventArgs e) { FormTrackpadConfig formTPConfig = new FormTrackpadConfig(); try { formTPConfig.ShowDialog(); } catch (Exception ex) { MessageBox.Show("ERROR: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Log.error(ex.Message); } finally { formTPConfig.Dispose(); } }
//show configuratrion panel. private void configurationToolStripMenuItem_Click(object sender, EventArgs e) { if (passwordConfirmed) { FormTrackpadConfig formTPConfig = new FormTrackpadConfig(); try { formTPConfig.ShowDialog(); } catch (Exception ex) { MessageBox.Show("ERROR: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { formTPConfig.Dispose(); } } else { MessageBox.Show("Please LogIn from the file Menu first\n Or you can contact your test engineer ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//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); } } }
//show configuratrion panel. private void configurationToolStripMenuItem_Click(object sender, EventArgs e) { if (passwordConfirmed) { FormTrackpadConfig formTPConfig = new FormTrackpadConfig(); try { formTPConfig.ShowDialog(); } catch (Exception ex) { MessageBox.Show("ERROR: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { formTPConfig.Dispose(); } } else MessageBox.Show("Please LogIn from the file Menu first\n Or you can contact your test engineer ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); }
private void startTest() { timer.Restart(); //string partType = serialNumber.Substring(0, PARTNUMBER_LENGTH); //if another test instance is running, then quit this test. if (test_running) { MessageBox.Show("Test is running", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (serialNumberScanned) { //Check Part type in Production.ini try { FormTrackpadConfig formTPConfig = new FormTrackpadConfig(); tpConfig = formTPConfig.read(serialNumber.Substring(0, PARTNUMBER_LENGTH)); if (Manufacture.testStation == "TMT") { tpConfigTestItems = tpConfig.TMT; } if (Manufacture.testStation == "OQC") { tpConfigTestItems = tpConfig.OQC; } if (Manufacture.testStation == "TPT") { tpConfigTestItems = tpConfig.TPT; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error: ", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show("Please contact your Test engineer for the config file", "Error: ", MessageBoxButtons.OK, MessageBoxIcon.Error); Log.error(ex.Message); return; } //Check if bridge is ready if (!bridgeReady) { MessageBox.Show("Please open the bridge first", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //Clear UI info listBoxStatus.Items.Clear(); textBoxStatus.Text = ""; textBoxStatus.BackColor = Color.White; //start thread of test functions testFunction = new TestFunction(serialNumber, bridge, tpConfig, Manufacture.testStation); //subscribe the listView or not if (currentMode.ModeType != ProductionMode) { testFunction.TestMessageEvent += new TestFunction.TestMessageEventHandler(testFunction_TestMessageEvent); } else { testFunction.TestMessageEvent -= new TestFunction.TestMessageEventHandler(testFunction_TestMessageEvent); } Task readTask = new Task(testProcess); readTask.Start(); Task processTask = new Task(dataProcess); processTask.Start(); test_running = true; } else { MessageBox.Show("Please input serial number", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//click the start button //check the hardware, serial number, online or offline, then start the test process private void buttonStart_Click(object sender, EventArgs e) { if (textBoxSN.Text.Length == 19 || textBoxSN.Text.Length == 20) { serialNumber = textBoxSN.Text; string partType = serialNumber.Substring(0, PARTNUMBER_LENGTH); string identifier = serialNumber.Substring(PARTNUMBER_LENGTH, (textBoxSN.Text.Length - PARTNUMBER_LENGTH)); serialNumber = partType + identifier; if (validateSerialNumber(serialNumber)) { textBoxSN.Text = identifier; textBoxMPN.Text = partType; serialNumberScanned = true; } else { MessageBox.Show("invalid serial number", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); textBoxSN.Text = ""; textBoxMPN.Text = ""; serialNumberScanned = false; } } timer.Restart(); //string partType = serialNumber.Substring(0, PARTNUMBER_LENGTH); //if another test instance is running, then quit this test. if (test_running) { MessageBox.Show("Test is running", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } ////show the workID panel if work ID is not valid. //while (DeviceConfig.Items.trackpad_ShopFloor == DeviceConfig.TPCONFIG.TP_TEST_ONLINE && TestFunction.WorkerID == "") //{ // FormOperaterID formWorkerID = new FormOperaterID(); // formWorkerID.ShowDialog(); // TestFunction.WorkerID = formWorkerID.WorkerID; //} //check if serial number is valid if (serialNumberScanned) { //Check Part type in Production.ini try { FormTrackpadConfig formTPConfig = new FormTrackpadConfig(); tpConfig = formTPConfig.read(serialNumber.Substring(0, PARTNUMBER_LENGTH)); if (Manufacture.testStation == "TMT") { tpConfigTestItems = tpConfig.TMT; } if (Manufacture.testStation == "OQC") { tpConfigTestItems = tpConfig.OQC; } if (Manufacture.testStation == "TPT") { tpConfigTestItems = tpConfig.TPT; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error: ", MessageBoxButtons.OK, MessageBoxIcon.Error); Log.error(ex.Message); return; } //Check if bridge is ready if (!bridgeReady) { MessageBox.Show("Please open the bridge first", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //Clear UI info listBoxStatus.Items.Clear(); textBoxStatus.Text = ""; textBoxStatus.BackColor = Color.White; //start thread of test functions testFunction = new TestFunction(serialNumber, bridge, tpConfig, Manufacture.testStation); //subscribe the listView or not if (currentMode.ModeType != ProductionMode) { testFunction.TestMessageEvent += new TestFunction.TestMessageEventHandler(testFunction_TestMessageEvent); } else { testFunction.TestMessageEvent -= new TestFunction.TestMessageEventHandler(testFunction_TestMessageEvent); } Task readTask = new Task(testProcess); readTask.Start(); Task processTask = new Task(dataProcess); processTask.Start(); //start test process in test main thread //testReadMainThread = new Thread(testProcess); //testReadMainThread.IsBackground = true; //testReadMainThread.Start(); //testDataMainThread = new Thread(dataProcess); //testDataMainThread.IsBackground = true; //testDataMainThread.Start(); test_running = true; //wait for the test main thread alive. //while (!testReadMainThread.IsAlive) //{ // testReadMainThread.Join(); // //System.Threading.Thread.Sleep(10); //} } else { MessageBox.Show("Please input serial number", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//click the start button //check the hardware, serial number, online or offline, then start the test process private void buttonStart_Click(object sender, EventArgs e) { string partType = "11600200"; currentMode = new Mode(EngineeringMode); this.ClientSize = currentMode.UISize; tabControlMain.Visible = true; productionModeToolStripMenuItem.Checked = false; engineeringModeToolStripMenuItem.Checked = true; debugModeToolStripMenuItem.Checked = false; //timer.Start(); timer.Restart(); if (serialNumber != "") { partType = serialNumber.Substring(0, PARTNUMBER_LENGTH); } //if another test instance is running, then quit this test. if (test_running) { MessageBox.Show("Test is running", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } ////show the workID panel if work ID is not valid. //while (DeviceConfig.Items.trackpad_ShopFloor == DeviceConfig.TPCONFIG.TP_TEST_ONLINE && TestFunction.WorkerID == "") //{ // FormOperaterID formWorkerID = new FormOperaterID(); // formWorkerID.ShowDialog(); // TestFunction.WorkerID = formWorkerID.WorkerID; //} //check if serial number is valid if (true) { //Check Part type in Production.ini try { FormTrackpadConfig formTPConfig = new FormTrackpadConfig(); tpConfig = formTPConfig.read(partType); if (Manufacture.testStation == "TMT") { tpConfigTestItems = tpConfig.TMT; } if (Manufacture.testStation == "OQC") { tpConfigTestItems = tpConfig.OQC; } if (Manufacture.testStation == "TPT") { tpConfigTestItems = tpConfig.TPT; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error: ", MessageBoxButtons.OK, MessageBoxIcon.Error); Log.error(ex.Message); return; } //Check if bridge is ready if (!bridgeReady) { MessageBox.Show("Please open the bridge first", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //Clear UI info listBoxStatus.Items.Clear(); textBoxStatus.Text = ""; textBoxStatus.BackColor = Color.White; //start thread of test functions testFunction = new TestFunction(serialNumber, bridge, tpConfig, Manufacture.testStation); //subscribe the listView or not if (currentMode.ModeType != ProductionMode) { testFunction.TestMessageEvent += new TestFunction.TestMessageEventHandler(testFunction_TestMessageEvent); } else { testFunction.TestMessageEvent -= new TestFunction.TestMessageEventHandler(testFunction_TestMessageEvent); } Task readTask = new Task(testProcess); readTask.Start(); Task processTask = new Task(dataProcess); processTask.Start(); //start test process in test main thread //testReadMainThread = new Thread(testProcess); //testReadMainThread.IsBackground = true; //testReadMainThread.Start(); //testDataMainThread = new Thread(dataProcess); //testDataMainThread.IsBackground = true; //testDataMainThread.Start(); test_running = true; //wait for the test main thread alive. //while (!testReadMainThread.IsAlive) //{ // testReadMainThread.Join(); // //System.Threading.Thread.Sleep(10); //} } else { MessageBox.Show("Please input serial number", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//click the start button //check the hardware, serial number, online or offline, then start the test process private void startTest() { //timer.Start(); timer.Restart(); string partType = serialNumber.Substring(0, PARTNUMBER_LENGTH); //if another test instance is running, then quit this test. if (test_running) { MessageBox.Show("Test is running", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //check if serial number is valid if (serialNumberScanned) { //Check Part type in Production.ini try { FormTrackpadConfig formTPConfig = new FormTrackpadConfig(); tpConfig = formTPConfig.read(serialNumber.Substring(0, PARTNUMBER_LENGTH)); if (Manufacture.testStation == "TMT") { tpConfigTestItems = tpConfig.TMT; } if (Manufacture.testStation == "OQC") { tpConfigTestItems = tpConfig.OQC; } if (Manufacture.testStation == "TPT") { tpConfigTestItems = tpConfig.TPT; } resolutionX.Text = Convert.ToString(tpConfig.RESOLUTION_X); resolutionY.Text = Convert.ToString(tpConfig.RESOLUTION_Y); int positonPanelX = Convert.ToInt32(Convert.ToInt32(resolutionX.Text) / positionPanelScale); int positonPanelY = Convert.ToInt32(Convert.ToInt32(resolutionY.Text) / positionPanelScale); PositionPanel.Size = new Size(positonPanelX, positonPanelY); textBoxSwitchL.BackColor = Color.White; textBoxSwitchR.BackColor = Color.White; //testFunction.targetPoint = new List<Point>(new Point[] { new Point(60, 60), new Point(tpConfig.RESOLUTION_X - 60, tpConfig.RESOLUTION_Y - 60) }); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error: ", MessageBoxButtons.OK, MessageBoxIcon.Error); Log.error(ex.Message); return; } //Check if bridge is ready if (!bridgeReady) { MessageBox.Show("Please open the bridge first", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //Clear UI info listBoxStatus.Items.Clear(); textBoxStatus.Text = ""; textBoxStatus.BackColor = Color.White; //start thread of test functions testFunction = new TestFunction(serialNumber, bridge, tpConfig, Manufacture.testStation); int radiusR = 0; testFunction.targetPoint = new List<Point>(new Point[] { new Point(radius, radius), new Point(radius, tpConfig.RESOLUTION_Y - radiusR), new Point(tpConfig.RESOLUTION_X - radiusR, radius), new Point(tpConfig.RESOLUTION_X - radiusR, tpConfig.RESOLUTION_Y - radiusR), new Point(radius, radius) }); //radius = Convert.ToInt32(radius / positionPanelScale); //subscribe the listView or not if (currentMode.ModeType != ProductionMode) { testFunction.TestMessageEvent += new TestFunction.TestMessageEventHandler(testFunction_TestMessageEvent); } else { testFunction.TestMessageEvent -= new TestFunction.TestMessageEventHandler(testFunction_TestMessageEvent); } Task readTask = new Task(testProcess); readTask.Start(); Task processTask = new Task(dataProcess); processTask.Start(); test_running = true; } else { MessageBox.Show("Please input serial number", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//click the start button //check the hardware, serial number, online or offline, then start the test process private void buttonStart_Click(object sender, EventArgs e) { //timer.Start(); timer.Restart(); string partType = serialNumber.Substring(0, PARTNUMBER_LENGTH); //if another test instance is running, then quit this test. if (test_running) { MessageBox.Show("Test is running", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } ////show the workID panel if work ID is not valid. //while (DeviceConfig.Items.trackpad_ShopFloor == DeviceConfig.TPCONFIG.TP_TEST_ONLINE && TestFunction.WorkerID == "") //{ // FormOperaterID formWorkerID = new FormOperaterID(); // formWorkerID.ShowDialog(); // TestFunction.WorkerID = formWorkerID.WorkerID; //} //check if serial number is valid if (serialNumberScanned) { //Check Part type in Production.ini try { FormTrackpadConfig formTPConfig = new FormTrackpadConfig(); tpConfig = formTPConfig.read(serialNumber.Substring(0, PARTNUMBER_LENGTH)); if (Manufacture.testStation == "TMT") { tpConfigTestItems = tpConfig.TMT; } if (Manufacture.testStation == "OQC") { tpConfigTestItems = tpConfig.OQC; } if (Manufacture.testStation == "TPT") { tpConfigTestItems = tpConfig.TPT; } resolutionX.Text = Convert.ToString(tpConfig.RESOLUTION_X); resolutionY.Text = Convert.ToString(tpConfig.RESOLUTION_Y); if (tpConfig.RESOLUTION_X > 600 || tpConfig.RESOLUTION_Y > 325) { positionPanelScale = 2; while ((tpConfig.RESOLUTION_X / positionPanelScale) > 600 || (tpConfig.RESOLUTION_Y / positionPanelScale) > 325) { positionPanelScale = positionPanelScale * 2; } } else { positionPanelScale = 0.5; while ((tpConfig.RESOLUTION_X / positionPanelScale) * 2 < 600 && (tpConfig.RESOLUTION_Y / positionPanelScale) * 2 < 325) { positionPanelScale = positionPanelScale * 0.5; } } int positonPanelX = Convert.ToInt32(Convert.ToInt32(resolutionX.Text) / positionPanelScale); int positonPanelY = Convert.ToInt32(Convert.ToInt32(resolutionY.Text) / positionPanelScale); PositionPanel.Size = new Size(positonPanelX, positonPanelY); textBoxSwitchL.BackColor = Color.White; textBoxSwitchR.BackColor = Color.White; //testFunction.targetPoint = new List<Point>(new Point[] { new Point(60, 60), new Point(tpConfig.RESOLUTION_X - 60, tpConfig.RESOLUTION_Y - 60) }); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error: ", MessageBoxButtons.OK, MessageBoxIcon.Error); Log.error(ex.Message); return; } //Check if bridge is ready if (!bridgeReady) { MessageBox.Show("Please open the bridge first", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //Clear UI info listBoxStatus.Items.Clear(); textBoxStatus.Text = ""; textBoxStatus.BackColor = Color.White; //start thread of test functions testFunction = new TestFunction(serialNumber, bridge, tpConfig, Manufacture.testStation); testFunction.targetPoint = new List<Point>(new Point[] { new Point(radius, radius), new Point(radius, tpConfig.RESOLUTION_Y - radius), new Point(tpConfig.RESOLUTION_X - radius, radius), new Point(tpConfig.RESOLUTION_X - radius, tpConfig.RESOLUTION_Y - radius), new Point(radius, radius) }); //radius = Convert.ToInt32(radius / positionPanelScale); //subscribe the listView or not if (currentMode.ModeType != ProductionMode) { testFunction.TestMessageEvent += new TestFunction.TestMessageEventHandler(testFunction_TestMessageEvent); } else { testFunction.TestMessageEvent -= new TestFunction.TestMessageEventHandler(testFunction_TestMessageEvent); } Task readTask = new Task(testProcess); readTask.Start(); Task processTask = new Task(dataProcess); processTask.Start(); test_running = true; } else { MessageBox.Show("Please input serial number", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }