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 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) { 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) { //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); } }