private void btnRefesh_Click(object sender, EventArgs e) { lblNG.Text = @"0"; lblPass.Text = @"0"; lblTotal.Text = @"0"; var allText = GetValueWindowText.GetAllTextFromWindowByTitle(cboWindows.EditValue.ToString()); Ultils.WriteFile(allText); MessageBox.Show("Ghi OK"); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void timerReadCom_Tick(object sender, EventArgs e) { var allText = GetValueWindowText.GetAllTextFromWindowByTitle(cboWindows.EditValue.ToString()); //var valueFirst = allText.Split(separator: new[] { "Remote Control" }, count: 4, options: StringSplitOptions.None); //var valueLast = valueFirst[1].Split(separator: new[] { "Remote controlFile" }, count: 4, options: StringSplitOptions.None); //string result = valueLast[0]; //if (result == barcode_old) //{ // //MessageBox.Show("Same" + result); // SetText(result); // SendKeys.Send("{ENTER}"); //} //else //{ // SetText(result); // barcode_old = result; // SendKeys.Send("{ENTER}"); //} }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void backgroundWorker1_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { while (backgroundWorker1.CancellationPending == false) { Thread.Sleep(2000); var allText = GetValueWindowText.GetAllTextFromWindowByTitle(cboWindows.EditValue.ToString()); //string allText = "10.751427478测试完成87.3OK2016/11/2 9:52:39X6AQ0683QYT2_960K 87372 K001DADF 960K87372"; var broad_id_first = allText.Split(new[] { "_" }, 4, StringSplitOptions.None); //var broad_id_first = allText.Split(new[] { "labelControl1" }, 4, StringSplitOptions.None); //var broad_id_last = broad_id_first[1].Split(new[] { "123456789" }, 4, StringSplitOptions.None); // Lấy giá trị serial //var broad_id_first = allText.Split(new[] { "S/N" }, 4, StringSplitOptions.None); //var broad_id_last = broad_id_first[1].Split(new[] { "NVM " }, 4, StringSplitOptions.None); _result = $"{ broad_id_first[0].Substring(broad_id_first[0].Length-12)}_{broad_id_first[1].Substring(0, 14)}"; //_result = broad_id_last[0].ToString(); if (_result.Length > 23) { _workOrderItems = _workOrderItemService.Get_WORK_ORDER_ITEMS_LIKE_BoardNo(_result); if (_workOrderItems != null) { if (!_workOrderItems.IS_FINISHED) { backgroundWorker1.ReportProgress(0, _workOrderItems.BOARD_NO); } else { SetStatusDefault("OK"); SetMessageDefault("Broad is finished."); } } else { backgroundWorker1.ReportProgress(0, _result); } } } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void backgroundWorker1_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { while (backgroundWorker1.CancellationPending == false) { Thread.Sleep(500); var allText = GetValueWindowText.GetAllTextFromWindowByTitle(cboWindows.EditValue.ToString()); //var broad_id_first = allText.Split(new[] {"labelControl1"}, 4, StringSplitOptions.None); //var broad_id_last = broad_id_first[1].Split(new[] {"123456789"}, 4, StringSplitOptions.None); // Lấy giá trị serial var broad_id_first = allText.Split(new[] { "S/N" }, 4, StringSplitOptions.None); var broad_id_last = broad_id_first[1].Split(new[] { "NVM " }, 4, StringSplitOptions.None); _result = $"{broad_id_last[0]}"; if (_result.Length > 10) { _workOrderItems = _workOrderItemService.Get_WORK_ORDER_ITEMS_LIKE_BoardNo(_result); if (_workOrderItems != null) { if (!_workOrderItems.IS_FINISHED) { backgroundWorker1.ReportProgress(0, _workOrderItems.BOARD_NO); } } else { backgroundWorker1.ReportProgress(0, _result); } } if (backgroundWorker1.CancellationPending) { backgroundWorker1.ReportProgress(0, null); } } }
private void backgroundWorker2_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { while (backgroundWorker2.CancellationPending == false) { Thread.Sleep(1000); var allText = GetValueWindowText.GetAllTextFromWindowByTitle(cboWindows.EditValue.ToString()); if (allText.Contains("...")) { allText = allText.Replace("...", ""); } var value = allText.Split(new[] { "." }, 4, StringSplitOptions.None); string resultSpit = value[1]; _strTimeRun = resultSpit.Remove(0, 12); _strTimeRun = $"{_strTimeRun}"; int n; if (int.TryParse(new string(_strTimeRun.Where(Char.IsDigit).ToArray()), out n)) { _strTimeRun = n.ToString(); } backgroundWorker2.ReportProgress(0, _strTimeRun); } }