private zkemkeeper.CZKEM axCZKEM2 = null; private zkemkeeper.CZKEM axCZKEM3 = null; private static bool bIsConnected2 = false; private static bool bIsConnected3 = false; private void button1_Click(object sender, EventArgs e) { #region THread 1 Thread createComAndMessagePumpThread = new Thread(() => { axCZKEM2 = new zkemkeeper.CZKEMClass(); bIsConnected = axCZKEM2.Connect_Net("192.168.10.35", 4370); if (bIsConnected == true) if (axCZKEM2.RegEvent(1, 65535))//Here you can register the realtime events that you want to be triggered(the parameters 65535 means registering all) { this.axCZKEM2.OnVerify += new zkemkeeper._IZKEMEvents_OnVerifyEventHandler(axCZKEM2_OnVerify); this.axCZKEM2.OnAttTransactionEx += new zkemkeeper._IZKEMEvents_OnAttTransactionExEventHandler(axCZKEM2_OnAttTransactionEx); } } Application.Run(); }); createComAndMessagePumpThread.IsBackground = false; createComAndMessagePumpThread.SetApartmentState(ApartmentState.STA); createComAndMessagePumpThread.Start(); #endregion #region Thread 2 Thread createComAndMessagePumpThread2 = new Thread(() => { axCZKEM3 = new zkemkeeper.CZKEMClass(); bIsConnected3 = axCZKEM3.Connect_Net("192.168.10.6", 4370); if (bIsConnected3 == true) { if (axCZKEM3.RegEvent(2, 65535))//Here you can register the realtime events that you want to be triggered(the parameters 65535 means registering all) { this.axCZKEM3.OnVerify += new zkemkeeper._IZKEMEvents_OnVerifyEventHandler(axCZKEM3_OnVerify); this.axCZKEM3.OnAttTransactionEx += new zkemkeeper._IZKEMEvents_OnAttTransactionExEventHandler(axCZKEM3_OnAttTransactionEx); } } Application.Run(); }); createComAndMessagePumpThread2.IsBackground = false; createComAndMessagePumpThread2.SetApartmentState(ApartmentState.STA); createComAndMessagePumpThread2.Start(); #endregion } private void axCZKEM2_OnVerify(int iUserID) { if (iUserID != -1) { İslemListesi1.Items.Add("Tanımlı Kart Okunurken Hata" + iUserID.ToString()).ForeColor = Color.Red; } else { İslemListesi1.Items.Add("222Tanımsız Kart Okutuldu").ForeColor = Color.Red; } } //If your fingerprint(or your card) passes the verification,this event will be triggered private void axCZKEM2_OnAttTransactionEx(string sEnrollNumber, int iIsInValid, int iAttState, int iVerifyMethod, int iYear, int iMonth, int iDay, int iHour, int iMinute, int iSecond, int iWorkCode) { string kartno = "...222UserID:" + sEnrollNumber; string tarih = "...Time:" + iYear.ToString() + "-" + iMonth.ToString() + "-" + iDay.ToString() + " " + iHour.ToString() + ":" + iMinute.ToString() + ":" + iSecond.ToString(); İslemListesi1.Items.Add(kartno + tarih).ForeColor = Color.Green; } private void axCZKEM3_OnVerify(int iUserID) { if (iUserID != -1) { İslemListesi1.Items.Add("Tanımlı Kart Okunurken Hata" + iUserID.ToString()).ForeColor = Color.Red; } else { İslemListesi1.Items.Add("3333Tanımsız Kart Okutuldu").ForeColor = Color.Red; } } //If your fingerprint(or your card) passes the verification,this event will be triggered private void axCZKEM3_OnAttTransactionEx(string sEnrollNumber, int iIsInValid, int iAttState, int iVerifyMethod, int iYear, int iMonth, int iDay, int iHour, int iMinute, int iSecond, int iWorkCode) { string kartno = "...333UserID:" + sEnrollNumber; string tarih = "...Time:" + iYear.ToString() + "-" + iMonth.ToString() + "-" + iDay.ToString() + " " + iHour.ToString() + ":" + iMinute.ToString() + ":" + iSecond.ToString(); İslemListesi1.Items.Add(kartno + tarih).ForeColor = Color.Green; }