private void BTN_SCAN_Click(object sender, EventArgs e) { try { this.BTN_SCAN.Click -= new System.EventHandler(this.BTN_SCAN_Click); BTN_SCAN.Enabled = false; if (txt_PassportNo.Text.Length > 0) { return; } //scan_worker = new Thread(run_progress); //scan_worker.Start(); txt_PassportNo.Text = ""; txt_CountryCode.Text = ""; txt_FirstName.Text = ""; txt_LastName.Text = ""; expiry_date = ""; date_of_birth = ""; gender = ""; Utils gtfUtil = new Utils(); setWaitCursor(true); m_passScan.close(); if (m_passScan.open(Constants.PASSPORT_TYPE) > 0) { int strmrz = m_passScan.scan(Constants.SCAN_TIMEOUT); if (strmrz > 0) { //싱가폴 if (m_passScan.GetNationality().Equals("SGP")) { MetroMessageBox.Show(this, Constants.CONF_MANAGER.getCustomValue("Message", Constants.SYSTEM_LANGUAGE + "/ValidatePassportSGP"), "Passport Info", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { txt_PassportNo.Text = m_passScan.GetPassportNo(); txt_CountryCode.Text = m_passScan.GetNationality(); txt_FirstName.Text = m_passScan.GetPassportLastName(); txt_LastName.Text = m_passScan.GetPassportFirstName(); expiry_date = "20" + m_passScan.GetExpireDate(); date_of_birth = gtfUtil.getFullDate(m_passScan.GetBirthDate()); gender = m_passScan.GetSex(); txt_PurchaseAmt.Focus(); } } else { MetroMessageBox.Show(this, Constants.CONF_MANAGER.getCustomValue("Message", Constants.SYSTEM_LANGUAGE + "/PassportReadError"), "Passport Info", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MetroMessageBox.Show(this, Constants.CONF_MANAGER.getCustomValue("Message", Constants.SYSTEM_LANGUAGE + "/PassportConnectError"), "Passport Info", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { Constants.LOGGER_MAIN.Error(ex.StackTrace); //MessageBox.Show(ex.Message); } finally { m_passScan.close(); BTN_SCAN.Enabled = true; setWaitCursor(false); /* * if(scan_worker.IsAlive) * { * scan_worker.Abort(); * } */ this.BTN_SCAN.Click += new System.EventHandler(this.BTN_SCAN_Click); } }