コード例 #1
0
 //Works on the accountNum phase
 public void accountNum(string buttonID)
 {
     //If they press enter
     if (buttonID == "Enter")
     {
         //If length isn't 6 then shout at them
         if (inputted.Length != 6)
         {
             changePhase("AccountNum");
             myATMScreen.setError("Please only input a 6 digit code");
             return;
         }
         //check account
         int tempInt;
         tempInt = myBank.findAccount(Convert.ToInt32(inputted));
         //If account doesn't exist then shout at them
         if (tempInt == -1)
         {
             changePhase("AccountNum");
             myATMScreen.setError("Please enter a valid account number");
             return;
         }
         account = myBank.getAccount(tempInt);
         changePhase("Pin");
     }
     else if (buttonID == "Clear")
     {
         changePhase("AccountNum");
     }
     else if (buttonID != "Cancel" && buttonID.Length == 1)
     {
         myATMScreen.setInput(myATMScreen.getInput() + buttonID);
         inputted += buttonID;
     }
 }
コード例 #2
0
 public Bank()
 {
     accounts     = new bankAccount[noOfAccounts];
     this.Visible = false;
     this.Hide();
     this.WindowState = FormWindowState.Minimized;
     accounts[0]      = new bankAccount("Steve", 111111, 1111, 300);
     accounts[1]      = new bankAccount("Peter", 222222, 2222, 750);
     accounts[2]      = new bankAccount("David", 333333, 3333, 3000);
     ATM.myBank       = this;
     ATM ATM1 = new ATM(true, true);
     ATM ATM2 = new ATM(false, true);
 }
コード例 #3
0
ファイル: Program.cs プロジェクト: CraigMethven/ATM
        public Bank()
        {
            accounts     = new bankAccount[noOfAccounts];
            this.Visible = false;
            this.Hide();
            this.WindowState = FormWindowState.Minimized;
            accounts[0]      = new bankAccount("Steve", 111111, 1111, 300);
            accounts[1]      = new bankAccount("Peter", 222222, 2222, 750);
            accounts[2]      = new bankAccount("David", 333333, 3333, 3000);

            ATM.myBank = this;



            Thread ATM1 = new Thread(new ThreadStart(startatm1));
            Thread ATM2 = new Thread(new ThreadStart(startatm2));

            ATM1.Start();
            ATM2.Start();

            //   new Thread(() =>
            //   {
            //       Thread.Sleep(6000);
            //       createATM1s();
            //  }) .Start();

            //  new Thread(() =>
            //   {
            //        Thread.Sleep(6000);
            //        createATM2s();
            //    }).Start();

            //      ThreadStart atm1 = new ThreadStart(createATM1s);
            //       atm1_t = new Thread(atm1);
            //      ThreadStart atm2 = new ThreadStart(createATM2s);
            //       atm2_t = new Thread(atm2);

            //  ATM ATM1 = new ATM(true, true);
            //   ATM ATM2 = new ATM(false, true);
        }