private string DeviceConfig(NutechLib Devices) { try { //-----------------------------------------Inisialiasi Coin Dispenser------------------------ ReturnStatusDevice = "Coin Dispenser Not Connected"; Devices.CoinDevices = new CoinDevices[2]; Devices.CoinDevices[0] = new CoinDevices(); Devices.CoinDevices[0].PortName = "COM15"; Devices.CoinDevices[0].DeviceID = 1; Devices.CoinDispenserInitialize(Devices.CoinDevices[0]); _CoinTrays = Devices.GetCoinDispenserTraysInfo(Devices.CoinDevices[0]); Devices.SetCoinDispenserAllLevelToZero(Devices.CoinDevices[0]); ReturnStatusDevice = ""; //----------------------------------------Inisialiasi Bill Acceptor------------------------- ReturnStatusDevice = "Bill Acceptor Not Connected"; Devices.SetBillAcceptorPort("COM5"); Devices.BillAcceptorInitialize(); ReturnStatusDevice = ""; //-----------------------------------------Inisialasi Cash Dispenser------------------------ ReturnStatusDevice = "Cash Dispenser Not Connected"; _Devices.SetBillDispenserPort("COM4"); Devices.CashDispenserInitialize(); _BillTray = Devices.GetCashDispenserTraysInfo(); if (_BillTray.Length != 2) { return("Error Cash Dispenser!\r\nThere is an Empty Tray, Please Enter The Tray Correctly!"); } if (_BillTray[0].value != BillValues.IDR2000) { return("Error Cash Dispenser!\r\nTray 1 Wrong Position\r\n\r\nInfo : Tray 2 Must Be IDR2000\r\nPlease Enter The Tray Correctly!"); } if (_BillTray[1].value != BillValues.IDR5000) { return("Error Cash Dispenser!\r\nTray 2 Wrong Position \r\nInfo : Tray 2 Must Be IDR5000\r\nPlease Enter The Tray Correctly!"); } ReturnStatusDevice = ""; return("OK"); } catch (Exception ex) { return(ReturnStatusDevice + "\r\n" + ex.ToString()); } }
private void FormParent_Load(object sender, EventArgs e) { t = new Thread(new ThreadStart(Loading)); t.Start(); Screen screen = Screen.PrimaryScreen; ScreenWidth = screen.Bounds.Width; ScreenHeight = screen.Bounds.Height; _Devices = new NutechLib(); returnMessage = DeviceConfig(_Devices); t.Abort(); if (returnMessage != "OK") { NotifMessage(returnMessage); } else { MessageBox.Show("LOGIN"); } }