Esempio n. 1
0
 private void Form1_FormClosing(object sender, FormClosingEventArgs e)
 {
     try
     {
         CVRSDK.CVR_CloseComm();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Esempio n. 2
0
 private void button2_Click(object sender, EventArgs e)
 {
     try
     {
         int isSuccess = CVRSDK.CVR_CloseComm();
         this.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Esempio n. 3
0
        private void buttonReadCard_Click(object sender, EventArgs e)
        {
            try
            {
                int iPort, iRetUSB = 0;
                for (iPort = 1001; iPort <= 1016; iPort++)
                {
                    iRetUSB = CVRSDK.CVR_InitComm(iPort);
                    if (iRetUSB == 1)
                    {
                        break;
                    }
                }

                if (iRetUSB == 1)
                {
                    this.labelOpResult.Text = "初始化成功!";
                }
                else
                {
                    this.labelOpResult.Text = "初始化失败!";
                }

                int authenticate = CVRSDK.CVR_Authenticate();
                if (authenticate == 1)
                {
                    int readContent = CVRSDK.CVR_Read_FPContent();
                    if (readContent == 1)
                    {
                        this.labelOpResult.Text = "读卡操作成功!";
                        FillData();
                    }
                    else
                    {
                        this.labelOpResult.Text = "读卡操作失败!";
                    }
                }
                else
                {
                    MessageBox.Show("未放卡或卡片放置不正确");
                }
                CVRSDK.CVR_CloseComm();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }