Ejemplo n.º 1
0
 private void Idteststop_Click(object sender, EventArgs e)
 {
     IDcardTest.CancelAsync();
     IDreader.Close();
     idteststop.Enabled   = false;
     idserialport.Enabled = true;
 }
Ejemplo n.º 2
0
 private void IDcardTest_DoWork(object sender, DoWorkEventArgs e)
 {
     //e.Cancel = true;
     idserialport.Enabled = false;
     IDreader.Open();
     button1.Text = "リーダー応答テスト中…";
     IDreader.Write(new byte[] { 0x01 }, 0, 1);
     //string a = IDreader.ReadLine();
     try
     {
         if (IDreader.ReadLine() == "OK\r")
         {
             button1.Text = "カードをかざして下さい…";
             try
             {
                 string stID  = IDreader.ReadLine().Split(',')[1];
                 string satID = IDreader.ReadLine().Split(',')[2];
                 button1.Text = stID + Environment.NewLine + satID;
             }
             catch (IndexOutOfRangeException)
             {
                 button1.Text = "カードからデータを読み込めません。";
             }
         }
         else
         {
             button1.Text = "リーダーエラー発生";
         }
         IDreader.Close();
         idteststop.Enabled   = false;
         idserialport.Enabled = true;
     }
     catch (IOException)
     {
         button1.Text = "キャンセルされました。";
     }
 }