我是POS系统的新手,所以如果我错过任何信息让我知道将用它编辑。
我已经通过设置在其他PC上安装了WINFORM,我希望在表单加载时顶部打开一个现金抽屉。我使用过Microsoft.PointOfService dll。继承了我的代码:
public partial class CashRegister : Form
{
CashDrawer myCashDrawer;
PosExplorer explorer;
public CashRegister()
{
InitializeComponent();
explorer = new Microsoft.PointOfService.PosExplorer();
DeviceInfo ObjDevicesInfo = explorer.GetDevice("CashDrawer", "EP-125k");
//myCashDrawer = (CashDrawer) explorer.CreateInstance(ObjDevicesInfo);
// myCashDrawer.OpenDrawer();
}
public void OpenCashDrawer()
{
myCashDrawer.Open();
myCashDrawer.Claim(1000);
myCashDrawer.DeviceEnabled = true;
myCashDrawer.OpenDrawer();
myCashDrawer.DeviceEnabled = false;
myCashDrawer.Release();
myCashDrawer.Close();
}
private void button1_Click(object sender, EventArgs e)
{
this.Close();
}
private void CashRegister_Load(object sender, EventArgs e)
{
// myCashDrawer.OpenDrawer();
}
}
但是当它执行时会出现以下错误:
类型初始化程序'Microsoft.PointOfService.Management.Explorer'抛出异常
任何人都可以提供帮助。
由于
编辑:这是TypeInitializationException错误的详细信息
`See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.TypeInitializationException: The type initializer for 'Microsoft.PointOfService.Management.Explorer' threw an exception. ---> Microsoft.PointOfService.PosLibraryException: Failed to open registry key HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\POSfor.NET\ControlAssemblies.
at Microsoft.PointOfService.Management.AssemblyLoader.Scan()
at Microsoft.PointOfService.Management.AssemblyLoader.Scan()
at Microsoft.PointOfService.Management.Explorer.ScanForSOAssemblies()
at Microsoft.PointOfService.Management.Explorer.Refresh()
at Microsoft.PointOfService.Management.Explorer..ctor()
at Microsoft.PointOfService.Management.Explorer..cctor()
--- End of inner exception stack trace ---
答案 0 :(得分:0)
我已经向你们所有人表示感谢,这只是一个愚蠢的错误。安装.Net v1.12.exe的POS并且没有任何错误。