Esempio 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;
        }
Esempio n. 2
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;
        }