2015-06-13 42 views
0

我正在使用zkemKeeper.dll類庫識別機器上的手指和臉部。它只適用於桌面應用程序。我在桌面上的設備之間同步了面孔。我需要在ASP.NET按鈕點擊中調用該方法。請告訴我在這種情況下我必須做些什麼?按鈕單擊ASP.NET調用Windows Form方法C#

+1

閱讀[本](http://stackoverflow.com/questions/528652/what-is-the-simplest-method-of-inter-process-communication-between-2-c-sharp-pro )和[that](https://msdn.microsoft.com/en-us/library/windows/desktop/aa365574(v = vs.85).aspx) –

+0

使用Tcp Listener監聽桌面應用程序中的端口。當您點擊ASP.Net按鈕時,向該應用程序發送http請求。 –

回答

1
public zkemkeeper.CZKEM zkemKeeper = new zkemkeeper.CZKEM();//initializing dll 

private bool bIsConnected = false;//the boolean value identifies whether the device is connected 
//Initializing bisconnected to connect the device 
bool bIsConnected = zkemKeeper.Connect_Net(txtip.Text, Convert.ToInt32(txtport.Text)); 
private void btnDownLoadFace_Click(object sender, EventArgs e) 
    { 
    string sUserID = ""; 
    string sName = ""; 
    string sPassword = ""; 
    int iPrivilege = 0; 
    bool bEnabled = false; 
    int iFaceIndex = 50;//the only possible parameter value 
    string sTmpData = ""; 
    int iLength = 0; 
    zkemKeeper.EnableDevice(iMachineNumber, false); 
     zkemKeeper.ReadAllUserID(iMachineNumber);//read all the user information to the memory 

     while (zkemKeeper.SSR_GetAllUserInfo(iMachineNumber, out sUserID, out sName, out sPassword, out iPrivilege, out bEnabled))//get all the users' information from the memory 
     { 
      if (zkemKeeper.GetUserFaceStr(iMachineNumber, sUserID, iFaceIndex, ref sTmpData, ref iLength))//get the face templates from the memory 
      { 
       //save whatever data you want for eg: 
       ListViewItem list = new ListViewItem(); 
       list.Text = sUserID; 
       list.SubItems.Add(sName); 
       list.SubItems.Add(sPassword); 
       list.SubItems.Add(iPrivilege.ToString()); 
       list.SubItems.Add(iFaceIndex.ToString()); 
       list.SubItems.Add(sTmpData); 
       list.SubItems.Add(iLength.ToString()); 
       if (bEnabled == true) 
       { 
        list.SubItems.Add("true"); 
       } 
       else 
       { 
        list.SubItems.Add("false"); 
       } 
       lvFace.Items.Add(list);//lv Face is a List View 
      } 
     } 
zkemKeeper.EnableDevice(iMachineNumber, true); 
}