/// <summary> /// 定时器刷新在线列表 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void TimDevice_Tick(object sender, EventArgs e) { new Thread(() => { try { string OutStr = adb.RunCmd("devices").Replace("device", ","); string listnew = Regex.Replace(OutStr.Substring(OutStr.IndexOf("attached") + 8), "\\s+", string.Empty); DutOnline = listnew; for (int r = 0; r < DGVOnline.RowCount; r++) { if (DGVOnline.Rows[r].Cells[0].Value.ToString().Length > 0) { if (!DutOnline.Contains(DGVOnline.Rows[r].Cells[0].Value.ToString())) { //清除离线的sn DGVOnline.Rows[r].Cells[0].Value = string.Empty; DGVOnline.Rows[r].Cells[1].Value = string.Empty; } else//移除已经显示的sn { listnew = listnew.Replace(DGVOnline.Rows[r].Cells[0].Value.ToString(), string.Empty); } } } foreach (string sn in listnew.Split(',')) { if (sn.Length == 0) { continue; } for (int r = 0; r < DGVOnline.RowCount; r++) { if (DGVOnline.Rows[r].Cells[0].Value.ToString().Length == 0) { DGVOnline.Rows[r].Cells[0].Value = sn; string mlb = adb.RunCmd("-s " + sn + " shell cat /factory_setting/mlb_sn.txt"); DGVOnline.Rows[r].Cells[1].Value = mlb; break; } } } } catch (Exception x) { TxtMSG.AppendText("adb devices错误!\r\n" + x.Message + "\r\n"); } }).Start(); }
/// <summary> /// 刷新在界面上显示的内容 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void TimFresh_Tick(object sender, EventArgs e) { if (TxtMSG.Text.Length > 1000) { TxtMSG.Clear(); } int TickSecond = Environment.TickCount / 1000; LabBoot.Location = new Point(this.Width - 300, 15); LabBoot.Text = String.Format("距上次维护时间:{0:00}:{1:00}:{2:00}s", TickSecond / 3600, (TickSecond % 3600) / 60, TickSecond % 60); LabPass.Text = "PASS:"******"RPASS:"******"FAIL:" + FPY.Fail; LabTotal.Text = "TOTAL:" + FPY.Total; LabInfo.Text = "OPID:" + Information.OPID + "\nFixID:" + Information.FixID; if (FPY.Total > 0) { LabFPY.Text = "FPY:" + ((float)FPY.Pass / FPY.Total).ToString("P2"); } }
/// <summary> /// 有多个DUT时测试挂起,若DUTTimeOut为true,则需等待DUT Boot成功 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void TimPending_Tick(object sender, EventArgs e) { if (TxtSN.Text.Length == 0) { return; } TxtMSG.AppendText("Wait for DUT:" + TxtSN.Text + "\r\n"); if (!DutOnline.Contains(TxtSN.Text)) { return; } if (TxtTest.Text.Length == 0 && (!TxtSN.Enabled)) { Runer.Restart(); TxtTest.Text = TxtSN.Text; Reset_DoubleClick(null, null); LabCount.Text = "COUNT:" + FPY.GetCount(TxtTest.Text); new Thread(() => { BoxTestEnterDown?.Invoke(TxtTest, new BoxEventArgs(TxtTest.Text)); }).Start(); } }