private void btnVerify_Click(object sender, EventArgs e)
        {
            try
            {
                MyKad_SDK.CBM_Init();
                int iReturn = -1;

                MyKad_SDK.CBM_RdrName[] dlgRdr = new MyKad_SDK.CBM_RdrName[100];
                iReturn = MyKad_SDK.CBM_Enumerate(dlgRdr);

                VerifyForm dlg = new VerifyForm(GetThumb1Path(), GetThumb2Path());
                dlg.ShowDialog();


                if (File.ReadAllText(Path.Combine(_workDirectory, _verifyStatus)) == "SUCCESS")
                {
                    ProfileInfo.IsVerified = true;
                }
                else
                {
                    ProfileInfo.IsVerified = false;
                }

                UpdateUI();
            }
            catch (Exception ex)
            {
            }
        }
Example #2
0
        private void btnVerify_Click(object sender, EventArgs e)
        {
            try
            {
                MyKad_SDK.CBM_Init();
                int iReturn = -1;

                MyKad_SDK.CBM_RdrName[] dlgRdr = new MyKad_SDK.CBM_RdrName[100];
                iReturn = MyKad_SDK.CBM_Enumerate(dlgRdr);


                VerifyForm dlg = new VerifyForm(_mp.MyKad.GetThumb1Path(), _mp.MyKad.GetThumb2Path());
                dlg.ShowDialog();
                //frmVerify2 f = new frmVerify2(_mp.MyKad.GetThumb1Path(), _mp.MyKad.GetThumb2Path());
                //f.ShowDialog();

                if (File.ReadAllText(Path.Combine(_mp.MyKad.GetWorkDirectory(), _mp.MyKad.GetVerifyStatus())) == "SUCCESS")
                {
                    _mp.UserProfile.IsVerified = true;
                    txtStatus.Text             = "VERIFIED";
                    txtStatus.BackColor        = Color.Green;
                    txtStatus.Update();
                    Thread.Sleep(500);
                    _mp.ShowForm(FormType.MainForm);
                }
                else
                {
                    _mp.UserProfile.IsVerified = false;
                    MessageBox.Show("Verification failed. Please try again.");
                }
                // UpdateUI();
            }
            catch (Exception ex)
            {
            }
        }
        private FpReturn ConnectSmartCard()
        {
            int status = 0;
            int state = 0;
            int ContextHandle = 0;
            uint readerCount = 0;
            byte[] pbyReaderNames = new byte[152];
            StringBuilder readerList = new StringBuilder();

            status = MyKad_SDK.SCardEstablishContext(0, 0, 0, ref ContextHandle);
            if (status != 0)
                return FpReturn.ErrorSCardEstablishContext;

            status = MyKad_SDK.SCardListReaders(ContextHandle, null, pbyReaderNames, out readerCount);
            if (status != 0)
                return FpReturn.ErrorSCardListReaders;

            byte[] rdr = new byte[readerCount];
            status = MyKad_SDK.SCardListReaders(ContextHandle, null, rdr, out readerCount);
            if (status != 0)
                return FpReturn.ErrorSCardListReaders;
            string strRdrName = null;
            for (int i = 0; i < readerCount; i++)
            {
                strRdrName += Convert.ToChar(rdr[i]);

            }

            string[] RdrName = strRdrName.Split('\0');

            MyKad_SDK.CBM_RdrName[] dlgRdr = new MyKad_SDK.CBM_RdrName[100];
            MyKad_SDK.CBM_Init();
            status = MyKad_SDK.CBM_Enumerate(dlgRdr);

            MyKad_SDK.CloseReader();

            status = MyKad_SDK.OpenReader();
            if (status != 0)
                return FpReturn.ErrorOpenReader;

            //string reader = IniFile.IniReadValue("device.ini", "Reader", "Name", @"IRIS BCR200DTP 11111001130700207 CT01 2");
            string reader = comboBox1.Text;
            status = MyKad_SDK.SelectDevice(reader, reader.Length);
            if (status != 0)
                return FpReturn.ErrorSelectDevice;

            status = MyKad_SDK.CardDetect(ref state);
            if (status != 0)
                return FpReturn.ErrorCardDetect;

            status = MyKad_SDK.CardConnectA();
            if (status != 0)
                return FpReturn.ErrorCardConnectA;

            status = MyKad_SDK.SelectPTS(0x13/*38400bps*/);
            if (status != 0)
                return FpReturn.SelectPTS;

            return FpReturn.Success;
        }
        private void btnVerify_Click(object sender, EventArgs e)
        {
            try
            {
                MyKad_SDK.CBM_Init();
                int iReturn = -1;

                MyKad_SDK.CBM_RdrName[] dlgRdr = new MyKad_SDK.CBM_RdrName[100];
                iReturn = MyKad_SDK.CBM_Enumerate(dlgRdr);

                VerifyForm dlg = new VerifyForm(GetThumb1Path(), GetThumb2Path());
                dlg.ShowDialog();

                if (File.ReadAllText(Path.Combine(_workDirectory, _verifyStatus)) == "SUCCESS")
                    ProfileInfo.IsVerified = true;
                else
                    ProfileInfo.IsVerified = false;

                UpdateUI();
            }
            catch (Exception ex)
            {
            }
        }
Example #5
0
        private FpReturn ConnectSmartCard(string reader)
        {
            int  status        = 0;
            int  state         = 0;
            int  ContextHandle = 0;
            uint readerCount   = 0;

            byte[]        pbyReaderNames = new byte[152];
            StringBuilder readerList     = new StringBuilder();

            status = MyKad_SDK.SCardEstablishContext(0, 0, 0, ref ContextHandle);
            if (status != 0)
            {
                return(FpReturn.ErrorSCardEstablishContext);
            }

            //status = MyKad_SDK.SCardListReaders(ContextHandle, null, pbyReaderNames, out readerCount);
            //if (status != 0)
            //    return FpReturn.ErrorSCardListReaders;


            //byte[] rdr = new byte[readerCount];
            //status = MyKad_SDK.SCardListReaders(ContextHandle, null, rdr, out readerCount);
            //if (status != 0)
            //    return FpReturn.ErrorSCardListReaders;
            //string strRdrName = null;
            //for (int i = 0; i < readerCount; i++)
            //{
            //    strRdrName += Convert.ToChar(rdr[i]);

            //}

            //string[] RdrName = strRdrName.Split('\0');


            MyKad_SDK.CBM_RdrName[] dlgRdr = new MyKad_SDK.CBM_RdrName[100];
            MyKad_SDK.CBM_Init();
            status = MyKad_SDK.CBM_Enumerate(dlgRdr);

            MyKad_SDK.CloseReader();

            status = MyKad_SDK.OpenReader();
            if (status != 0)
            {
                return(FpReturn.ErrorOpenReader);
            }

            //string reader = IniFile.IniReadValue("device.ini", "Reader", "Name", @"IRIS BCR200DTP 11111001130700207 CT01 2");
            //string reader = comboBox1.Text;
            status = MyKad_SDK.SelectDevice(reader, reader.Length);
            if (status != 0)
            {
                return(FpReturn.ErrorSelectDevice);
            }

            status = MyKad_SDK.CardDetect(ref state);
            if (status != 0)
            {
                return(FpReturn.ErrorCardDetect);
            }

            status = MyKad_SDK.CardConnectA();
            if (status != 0)
            {
                return(FpReturn.ErrorCardConnectA);
            }

            status = MyKad_SDK.SelectPTS(0x13 /*38400bps*/);
            if (status != 0)
            {
                return(FpReturn.SelectPTS);
            }

            return(FpReturn.Success);
        }
Example #6
0
        private void btnVerify_Click(object sender, EventArgs e)
        {
            try
            {
                MyKad_SDK.CBM_Init();
                int iReturn = -1;

                MyKad_SDK.CBM_RdrName[] dlgRdr = new MyKad_SDK.CBM_RdrName[100];
                iReturn = MyKad_SDK.CBM_Enumerate(dlgRdr);

                VerifyForm dlg = new VerifyForm(_mp.MyKad.GetThumb1Path(), _mp.MyKad.GetThumb2Path());
                dlg.ShowDialog();
                //frmVerify2 f = new frmVerify2(_mp.MyKad.GetThumb1Path(), _mp.MyKad.GetThumb2Path());
                //f.ShowDialog();

                if (File.ReadAllText(Path.Combine(_mp.MyKad.GetWorkDirectory(), _mp.MyKad.GetVerifyStatus())) == "SUCCESS")
                {
                    _mp.UserProfile.IsVerified = true;
                    txtStatus.Text = "VERIFIED";
                    txtStatus.BackColor = Color.Green;
                    txtStatus.Update();
                    Thread.Sleep(500);
                    _mp.ShowForm(FormType.MainForm);

                }
                else
                {
                    _mp.UserProfile.IsVerified = false;
                    MessageBox.Show("Verification failed. Please try again.");
                }
               // UpdateUI();
            }
            catch (Exception ex)
            {
            }
        }