private void BTN_SCAN_TEST_Click(object sender, EventArgs e) { try { if (COM_PASS_SCAN.SelectedIndex < 0) { return; } setWaitCursor(true); GTF_PassportScanner passScan = GTF_PassportScanner.Instance(null, Constants.PATH_TEMP); int nRet = 0; //nRet = passScan.open(COM_PASS_SCAN.SelectedIndex); if ("GTF-PS01(GTF)".Equals(COM_PASS_SCAN.SelectedItem)) { nRet = passScan.open(0); } else if ("NP-1000(OKPOS)".Equals(COM_PASS_SCAN.SelectedItem)) { nRet = passScan.open(3); } else if ("WISESCAN420".Equals(COM_PASS_SCAN.SelectedItem)) { nRet = passScan.open(1); } else if ("COMBOSMART(DAWIN)".Equals(COM_PASS_SCAN.SelectedItem)) { nRet = passScan.open(2); } if (nRet > 0) { Constants.PASSPORT_SCAN_OPEN = true; //COM_PASS_SCAN.Enabled = false; int strmrz = passScan.scan(30); if (strmrz > 0) { string strTempData = passScan.getMRZ1() + "\n" + passScan.getMRZ2(); MetroMessageBox.Show(this, strTempData /*+ "\n"+passScan.GetPassportFirstName()+"\n"+ passScan.GetPassportLastName() +"\n"+ passScan.GetPassportName()*/ , "Passport Info", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { MetroMessageBox.Show(this, Constants.getMessage("PASSPORT_REMOVE"), "Passport Info", MessageBoxButtons.OK, MessageBoxIcon.Information); } passScan.close(); } else { MetroMessageBox.Show(this, Constants.getMessage("PASSPORT_ERROR"), "Passport Info", MessageBoxButtons.OK, MessageBoxIcon.Error); } } finally { setWaitCursor(false); BTN_SCAN_TEST.Focus(); } }
private void BTN_SCAN_TEST_Click(object sender, EventArgs e) { GTF_PassportScanner passScan = GTF_PassportScanner.Instance(); try { setWaitCursor(true); int nRet = 0; passScan.close(); if ("GTF".Equals(COM_PASS_SCAN.SelectedItem)) { nRet = passScan.open(0); } else if ("OKPOS".Equals(COM_PASS_SCAN.SelectedItem)) { nRet = passScan.open(3); } else if ("WISESCAN420".Equals(COM_PASS_SCAN.SelectedItem)) { nRet = passScan.open(1); } else if ("DAWIN(GTF SG)".Equals(COM_PASS_SCAN.SelectedItem)) { nRet = passScan.open(2); } if (nRet > 0) { int strmrz = passScan.scan(30); if (strmrz > 0) { string strTempData = "Passport Data\n" + passScan.getMRZ1() + "\n" + passScan.getMRZ2(); MetroMessageBox.Show(this, strTempData, "Passport Info", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { MetroMessageBox.Show(this, "Please check if passport is inserted into slot", "Passport Info", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MetroMessageBox.Show(this, "Passport scanner not connected", "Passport Info", MessageBoxButtons.OK, MessageBoxIcon.Error); } } finally { passScan.close(); setWaitCursor(false); BTN_SCAN_TEST.Focus(); } }
private void BTN_SCAN_TEST_Click(object sender, EventArgs e) { try { if (COM_PASS_SCAN.SelectedIndex < 0) { return; } setWaitCursor(true); GTF_PassportScanner passScan = GTF_PassportScanner.Instance(null, Constants.PATH_TEMP); int nRet = 0; //nRet = passScan.open(COM_PASS_SCAN.SelectedIndex); if ("GTF-PS01(GTF)".Equals(COM_PASS_SCAN.SelectedItem)) { nRet = passScan.open(0); } else if ("NP-1000(OKPOS)".Equals(COM_PASS_SCAN.SelectedItem)) { nRet = passScan.open(3); } else if ("WISESCAN420".Equals(COM_PASS_SCAN.SelectedItem)) { nRet = passScan.open(1); } else if ("COMBOSMART(DAWIN)".Equals(COM_PASS_SCAN.SelectedItem)) { nRet = passScan.open(2); } if (nRet > 0) { Constants.PASSPORT_SCAN_OPEN = true; //COM_PASS_SCAN.Enabled = false; int strmrz = passScan.scan(30); if (strmrz > 0) { string strTempData = passScan.getMRZ1() + "\n" + passScan.getMRZ2(); MetroMessageBox.Show(this, strTempData, "Passport Info", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); string mrz2 = passScan.getMRZ2(); //int ncrc = int.Parse(passScan.getMRZ2()); Utils gtfUtil = new Utils(); bool check_result = gtfUtil.checkMRZLine2(mrz2); //MetroMessageBox.Show(this, "passportNumber[" + passnumber + "] check Digit[" + ncrc+ "] Check Result[" + check_result + "]" ); MetroMessageBox.Show(this, "getMRZ2[" + mrz2 + "] Check Result[" + check_result + "]"); } else { MetroMessageBox.Show(this, Constants.getMessage("PASSPORT_REMOVE"), "Passport Info", MessageBoxButtons.OK, MessageBoxIcon.Information); } passScan.close(); } else { MetroMessageBox.Show(this, Constants.getMessage("PASSPORT_ERROR"), "Passport Info", MessageBoxButtons.OK, MessageBoxIcon.Error); } } finally { setWaitCursor(false); BTN_SCAN_TEST.Focus(); } }