0


I am new in POS system, so if I miss out any info let me know will edit with it. I have installed a WINFORM on other PC through setup, and I want top open a cash drawer attached to it on form load. I have used Microsoft.PointOfService dll. And heres my code :

  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();
    }
}

But when it executes it gives following error:

type initializer for 'Microsoft.PointOfService.Management.Explorer' threw an exception

Can any one help.

Thanks

EDIT : this is the TypeInitializationException error's details

`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 ---
4

1 回答 1

0

感谢大家,我已经修复了,这只是 .Net v1.12.exe 的一个愚蠢的 misout.nstalled POS,它没有给出任何错误。

于 2013-08-29T08:10:40.137 回答