2013-10-28 35 views
0

我需要創建一些接口來從iButton讀取數據。實際上,它的工作原理是這樣的:用戶將帶有磁鐵的小吊墜應用於iButton設備 - >登錄他。用戶帶走吊墜 - 註銷。更改字符串時引發事件

我的問題是,我知道如何重新登錄,通過簡單:

public static void sp_DataReceived(object sender, SerialDataReceivedEventArgs e) 
     { 
      if (sp.ReadLine() == "logout") 
      { 
       logoutUser(); 
      } 
      else 
      { 
       //put data into nonstatic textbox from another window 
       // or raise some event which will listen to changes in data and put string into textbox 
      } 
     } 

但我怎麼能提高時,事件數據=「註銷」(例如A0019293881,如PIN碼)!

回答

1

您可以創建自己的事件,然後在else子句中創建一個事件,然後創建一些方法來聽取事件並執行所需操作。

更多關於活動here