在ASP.NET中单击按钮调用Windows窗体方法C#

时间:2015-06-13 08:19:52

标签: c# asp.net winforms web-services

我正在使用手指和脸部识别使用zkemKeeper.dll类库的机器。它仅适用于桌面应用程序。我在桌面上的设备之间同步了面孔。我需要在ASP.NET按钮单击中调用该方法。请告诉我在这种情况下我必须做什么?

1 个答案:

答案 0 :(得分: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);
}