Exemple #1
0
        public void Initialize(ListBoxHelper listBoxHelper, decimal bankAmt, int numCustomers, int numTellers, decimal goalAmt, decimal maxTransAmt, decimal initialAmt)
        {
            this._bankAmt       = bankAmt;
            this._numCustomers  = numCustomers;
            this._numTellers    = numTellers;
            this._goalAmt       = goalAmt;
            this._maxTransAmt   = maxTransAmt;
            this._initialAmt    = initialAmt;
            this._listBoxHelper = listBoxHelper;

            _workQuitEvent = new ManualResetEvent(false);
        }
Exemple #2
0
        public Teller(int ID, string name, ListBoxHelper listBoxHelper, ManualResetEvent quitEvent, ManualResetEvent workToDoEvent, Bank bank)
        {
            this._name          = name;
            this._ID            = ID;
            this._listBoxHelper = listBoxHelper;
            this._quitEvent     = quitEvent;
            this._workToDoEvent = workToDoEvent;
            this._bank          = bank;

            thread = new Thread(new ThreadStart(ThreadProc));
            thread.Start();
        }
Exemple #3
0
        public Bank(BankSimulator bankSim, ListBoxHelper listBoxHelper, ManualResetEvent workQuitEvent, decimal bankAmt, int numCustomers, int numTellers, decimal goalAmt, decimal maxTransAmt, decimal initialCustAmt)
        {
            _bankSim      = bankSim;
            _numCustomers = numCustomers;
            _numTellers   = numTellers;

            _goalAmt        = goalAmt;
            _maxTransAmt    = maxTransAmt;
            _initialCustAmt = initialCustAmt;

            _workQuitEvent  = workQuitEvent;
            _listBoxHelper  = listBoxHelper;
            _workReadyEvent = new ManualResetEvent(false);
            _workReadyEvent.Reset();

            _bankQueue = new BankQueue(_workReadyEvent);

            CreateTellerList(_numTellers);
            CreateCustomerList(_numCustomers);

            _vault         = new Vault(_workReadyEvent, this);
            _vault.Balance = bankAmt;
        }
Exemple #4
0
 public Form1()
 {
     InitializeComponent();
     listBoxHelper = new ListBoxHelper(listBox1);
 }