Example #1
0
        private PayLink()
        {
            Console.WriteLine("start");
            mhe = new MHE();

            int Ret = mhe.Open();

            if (Ret != 0)
            {
                Console.WriteLine("MHE Open error " + Ret.ToString());
            }
            else
            {
                // remember present current values
                TotalAccepted  = mhe.CurrentValue;
                EscrowAtAccept = mhe.Escrow.Throughput;

                // initialse Escrow as enabled
                mhe.Escrow.Enabled = false;

                // set the curent acceptor to the first in the list
                if (mhe.Acceptors.Count > 0)
                {
                    currentAcceptor = mhe.Acceptors[1];
                    Console.WriteLine(mhe.Acceptors[0]);
                    Console.WriteLine(mhe.Acceptors[1]);
                    Console.WriteLine(mhe.Acceptors[2]);
                }
            }
        }
        private void Form1_Load(object sender, System.EventArgs e)
        {
            mhe = new MHE();

            int Ret = mhe.Open();
            if( Ret != 0 )
            {
                MessageBox.Show("MHE Open error " + Ret.ToString()) ;
                this.Close();
            }
            else
            {
                mhe.Enabled = true;

                // remember present current values
                TotalAccepted = mhe.CurrentValue;
                EscrowAtAccept = mhe.Escrow.Throughput;

                // initialse Escrow as enabled
                EscrowEnabledCheckBox.Checked = true;
                mhe.Escrow.Enabled = true;

                // set the curent acceptor to the first in the list
                if (mhe.Acceptors.Count > 0)
                {
                    currentAcceptor = mhe.Acceptors[0];
                }
                // bind acceptors to drop-down in form
                acceptorComboBox.DataSource = mhe.Acceptors;
                acceptorComboBox.SelectedIndex = 0;
                InitialiseAcceptorControls();

                // initialise the Dispenser Panel
                for (int i = 0; i < 16; ++i)
                {
                    MHE.Dispenser dispenser = mhe.Dispensers[i];
                    if (dispenser != null)
                    {
                        NewDispenserPanel(i, dispenser);
                    }
                }

                // initialise the meter panel
                InitialiseMeterControls();

                // initialise the LED states
                InitialiseLEDs();

                // show current values
                UpdateControls();

                Timer.Enabled = true ;
            }
        }
        private void acceptorComboBox_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            currentAcceptor = (AES.MHE.Acceptor)this.acceptorComboBox.SelectedItem;

            InitialiseAcceptorControls();
        }