Exemplo n.º 1
0
        private void CreateBillValidator()
        {
            var con = new ConnectionRs232
                        {
                            PortName = GetCom(),
                            RemoveEcho = true // if we are connected to USB-COM echo is present otherwise set to false
                        };

            Dictionary<byte, BillTypeInfo> notes;
            if (!BillValidator.TryParseConfigWord(configWord.Text, out notes))
            {
                MessageBox.Show("Wrong config word, using defaults");

                notes = BillValidator.DefaultConfig;
                configWord.Text = BillValidator.ConfigWord(BillValidator.DefaultConfig);
            }

            _billValidator = new BillValidator(Convert.ToByte(deviceNumber.Value), con, notes, null);

            _billValidator.NotesAccepted += BillValidatorNotesAccepted;
            _billValidator.ErrorMessageAccepted += BillValidatorErrorMessageAccepted;

            _billValidator.Init();

            groupBox1.Enabled = true;
            panel1.Enabled = true;

            initCoinButton.Enabled = false;
            resetButton.Enabled = true;
            configWord.Enabled = false;
        }
Exemplo n.º 2
0
        private void DisposeBillValidator()
        {
            if (_billValidator == null)
                return;

            if (_billValidator.IsInitialized)
            {
                _billValidator.IsInhibiting = true;
                _billValidator.UnInit();
            }

            _billValidator.Dispose();

            _billValidator = null;

            groupBox1.Enabled = false;
            panel1.Enabled = false;
            initCoinButton.Enabled = true;
            resetButton.Enabled = false;
            configWord.Enabled = true;
        }
Exemplo n.º 3
0
        private void CreateBillValidator()
        {
            // Create a factory object and configure it.
            var devFactory = new DeviceFactory();
            devFactory.ComPort = GetCom();
            devFactory.ConfigWord = configWord.Text;
            // Create the device controller
            _billValidator = (BillValidator)devFactory.CreateDevice(CctalkDeviceTypes.BillValidator);

            _billValidator.MoneyAccepted += BillValidatorNotesAccepted;
            _billValidator.ErrorMessage += BillValidatorErrorMessageAccepted;

            _billValidator.Init();

            groupBox1.Enabled = true;
            panel1.Enabled = true;

            initCoinButton.Enabled = false;
            resetButton.Enabled = true;
            configWord.Enabled = false;
        }