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

Button click in ASP.NET invoke Windows Form method C#
2020-10-17
  •  译文(汉语)
  •  原文(英语)

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

速聊1:
阅读这个那个
速聊2:
使用Tcp侦听器侦听桌面应用程序中的端口.当您单击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);
}

I am working on finger and face identify machines which use zkemKeeper.dll class library. It only works on desktop application. I have synchronized faces between the devices on desktop. I need to invoke that method in ASP.NET button click. Kindly suggest me what I have to do in this scenario?

Talk1:
Read this and that
Talk2:
Listen on a port in your desktop application by using Tcp Listener. Send http request to that application when you click ASP.Net button.
Solutions1
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);
}
转载于:https://stackoverflow.com/questions/30816587/button-click-in-asp-net-invoke-windows-form-method-c-sharp

本人是.net程序员,因为英语不行,使用工具翻译,希望对有需要的人有所帮助
如果本文质量不好,还请谅解,毕竟这些操作还是比较费时的,英语较好的可以看原文

留言回复
我们只提供高质量资源,素材,源码,坚持 下了就能用 原则,让客户花了钱觉得值
上班时间 : 周一至周五9:00-17:30 期待您的加入