我正在使用第三方dll集成zteco生物识别设备。我通过使用tlbimp.exe并复制它来添加zkemkeeper.dll。
这是我的连接类
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;
namespace RTEvents
{
public partial class Main : Form
{
public Main()
{
InitializeComponent();
}
private void connectionToolStripMenuItem_Click(object sender, EventArgs e)
{
Connectivity con = new Connectivity();
con.MdiParent = this;
con.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
con.ControlBox = false;
con.MaximizeBox = false;
con.MinimizeBox = false;
con.Text = "";
con.Dock = DockStyle.Fill;
con.Show();
}
private void Main_Load(object sender, EventArgs e)
{
try
{
IsMdiContainer = true;
WindowState = FormWindowState.Normal;
this.toolStripStatusLabel1.Text = "Checking device status...";
new Thread(() =>
{
Thread.CurrentThread.IsBackground = true;
Connection con = new Connection();
RealTimeEvents rt = new RealTimeEvents();
if (con.CheckConnectivity(Connection.axCZKEM1))
{
this.toolStripStatusLabel1.Text = "Device connected";
con.DeviceProcess(rt);
}
else
{
this.toolStripStatusLabel1.Text = "Device not connected";
}
}).Start();
}
catch { }
}
public void setStatusLabel(string text)
{
this.toolStripStatusLabel1.Text = text;
}
}
}
using System;
命名空间RTEvents{class Connection{public static string IP=“192.168.1.3”;public static string PORT=“4370”;public static string MACHINE_NUMBER=“1”;public static string MASK=“65535”;public static zkemkeeper.czkemclass axCZKEM1=new zkemkeeper.czkemclass();public static bool isConnected=false;public void DeviceProcess(RealTimeEvents rt){
if (Connection.axCZKEM1.RegEvent(Convert.ToInt32(MACHINE_NUMBER), Convert.ToInt32(MASK)))//Here you can register the realtime events that you want to be triggered(the parameters 65535 means registering all)
{
Connection.axCZKEM1.OnFinger += new zkemkeeper._IZKEMEvents_OnFingerEventHandler(rt.axCZKEM1_OnFinger);
Connection.axCZKEM1.OnVerify += new zkemkeeper._IZKEMEvents_OnVerifyEventHandler(rt.axCZKEM1_OnVerify);
Connection.axCZKEM1.OnAttTransactionEx += new zkemkeeper._IZKEMEvents_OnAttTransactionExEventHandler(rt.axCZKEM1_OnAttTransactionEx);
Connection.axCZKEM1.OnFingerFeature += new zkemkeeper._IZKEMEvents_OnFingerFeatureEventHandler(rt.axCZKEM1_OnFingerFeature);
Connection.axCZKEM1.OnEnrollFingerEx += new zkemkeeper._IZKEMEvents_OnEnrollFingerExEventHandler(rt.axCZKEM1_OnEnrollFingerEx);
Connection.axCZKEM1.OnDeleteTemplate += new zkemkeeper._IZKEMEvents_OnDeleteTemplateEventHandler(rt.axCZKEM1_OnDeleteTemplate);
Connection.axCZKEM1.OnNewUser += new zkemkeeper._IZKEMEvents_OnNewUserEventHandler(rt.axCZKEM1_OnNewUser);
Connection.axCZKEM1.OnHIDNum += new zkemkeeper._IZKEMEvents_OnHIDNumEventHandler(rt.axCZKEM1_OnHIDNum);
Connection.axCZKEM1.OnAlarm += new zkemkeeper._IZKEMEvents_OnAlarmEventHandler(rt.axCZKEM1_OnAlarm);
Connection.axCZKEM1.OnDoor += new zkemkeeper._IZKEMEvents_OnDoorEventHandler(rt.axCZKEM1_OnDoor);
Connection.axCZKEM1.OnWriteCard += new zkemkeeper._IZKEMEvents_OnWriteCardEventHandler(rt.axCZKEM1_OnWriteCard);
Connection.axCZKEM1.OnEmptyCard += new zkemkeeper._IZKEMEvents_OnEmptyCardEventHandler(rt.axCZKEM1_OnEmptyCard);
Connection.isConnected = true;
}
}
public void UnProcessDevice(RealTimeEvents rt)
{
Connection.axCZKEM1.Disconnect();
Connection.axCZKEM1.OnFinger -= new zkemkeeper._IZKEMEvents_OnFingerEventHandler(rt.axCZKEM1_OnFinger);
Connection.axCZKEM1.OnVerify -= new zkemkeeper._IZKEMEvents_OnVerifyEventHandler(rt.axCZKEM1_OnVerify);
Connection.axCZKEM1.OnAttTransactionEx -= new zkemkeeper._IZKEMEvents_OnAttTransactionExEventHandler(rt.axCZKEM1_OnAttTransactionEx);
Connection.axCZKEM1.OnFingerFeature -= new zkemkeeper._IZKEMEvents_OnFingerFeatureEventHandler(rt.axCZKEM1_OnFingerFeature);
Connection.axCZKEM1.OnEnrollFingerEx -= new zkemkeeper._IZKEMEvents_OnEnrollFingerExEventHandler(rt.axCZKEM1_OnEnrollFingerEx);
Connection.axCZKEM1.OnDeleteTemplate -= new zkemkeeper._IZKEMEvents_OnDeleteTemplateEventHandler(rt.axCZKEM1_OnDeleteTemplate);
Connection.axCZKEM1.OnNewUser -= new zkemkeeper._IZKEMEvents_OnNewUserEventHandler(rt.axCZKEM1_OnNewUser);
Connection.axCZKEM1.OnHIDNum -= new zkemkeeper._IZKEMEvents_OnHIDNumEventHandler(rt.axCZKEM1_OnHIDNum);
Connection.axCZKEM1.OnAlarm -= new zkemkeeper._IZKEMEvents_OnAlarmEventHandler(rt.axCZKEM1_OnAlarm);
Connection.axCZKEM1.OnDoor -= new zkemkeeper._IZKEMEvents_OnDoorEventHandler(rt.axCZKEM1_OnDoor);
Connection.axCZKEM1.OnWriteCard -= new zkemkeeper._IZKEMEvents_OnWriteCardEventHandler(rt.axCZKEM1_OnWriteCard);
Connection.axCZKEM1.OnEmptyCard -= new zkemkeeper._IZKEMEvents_OnEmptyCardEventHandler(rt.axCZKEM1_OnEmptyCard);
Connection.isConnected = false;
}
public bool CheckConnectivity(zkemkeeper.CZKEMClass axCZKEM1)
{
if (isConnected == false)
{
if (axCZKEM1.Connect_Net(IP, Convert.ToInt32(PORT)))
{
isConnected = true;
return isConnected;
}
else
{
return false;
}
}
return false;
}
}
}
这是错误,我不知道如何解决它,这是错误
这种类型的异常是在构造类时引发的,无法分配特定的静态属性。
请参阅MDSN中的文档;
https://msdn.microsoft.com/en-us/library/system.TypeInitializationException(v=vs.110).aspx#静态
在你的班级里你有;
public static zkemkeeper.CZKEMClass ... = new zkemkeeper.CZKEMClass();
尝试移除此(出于调试目的),并查看是否仍引发异常。如果不是,那么你知道这就是问题所在。至于原因这一根本问题,我们需要更多关于这个zkemkeeper DLL的信息。
我正在构建一个颤振应用程序,我必须解析api中的一些数据,我设置了所有内容,但我收到了这个错误,我不知道为什么,我是颤振新手,任何帮助都将不胜感激。谢谢。 生成的错误 这是我的api响应示例 这就是我处理数据的方式 这是模型课
问题内容: 我之前从未遇到过此错误,所以我不确定该怎么做或意味着什么 未处理的异常类型 它在以下代码中发生: 它给了我2个选项“添加抛出声明”和“使用try / catch进行环绕”。 我该怎么办,为什么? 问题答案: 这意味着您要调用的方法已使用指令声明了从类派生的异常。当以这种方式声明一个方法时,您将被迫使用一个块来处理该异常,或者将一个相同的(对于相同的异常或超类型)语句添加到您的方法声明中
我正在运行一个简单的代码来启动Firefox浏览器。在Visual Studio中运行它。代码如下: 获取错误异常为: “System”类型的未处理异常。WebDriver中发生“InvalidOperationException”。dll其他信息:为安装功能转发新的虚拟机会话空池时出错[{browserName=firefox,version=firefox,platform=ANY}] 谁能告
问题内容: 我想捕获一个异常,将其记录下来,设置一个标志,然后重新抛出相同的异常 我有这个代码: 但是eclipse在throw ex时抱怨,说“未处理的异常类型Exception”,建议我在它周围添加一个try-catch块。 实际上,我希望调用此方法的进程处理该异常,而不是自己处理……如果一切正常,我只想返回true,如果有异常,则将其记录下来 另一方面,我可以将异常包装在另一个异常中,但是不
我收到了错误消息: 被精确定位的线在这里: 返回类型为
我正在解码一个响应体,我得到了错误: 我在Udemy上学习颤振教程时,正在尝试使用API。教程说要使用https://javiercbk.github.io/json_to_dart/将JSON转换为Dart。我把JSON从https://www.openbrewerydb.org/并将其转换为Dart,但我遇到的问题是,当我尝试解码API时,我得到了未处理的错误异常:“List”类型不是“Map