private void MaintButton_Click(object sender, EventArgs e) { CardForm form = new CardForm(_simAtm, "Enter the password to go to maintenance mode", 16); form.ShowDialog(); }
private void OnPhysButton6_Click(object sender, EventArgs e) { switch (_simAtm.currentState) { case ATM.State.RequestPIN: string password = PasswordBox.Text; PasswordBox.Text = ""; if (_simAtm.CheckPIN(password)) { _simAtm.MainMenu(); } else { if (_simAtm.attemptsPIN == _simAtm.attemptsAllowedPIN) { MessageBox.Show("Wrong PIN-code. No attempts left. Your card is blocked.", "Card is blocked", MessageBoxButtons.OK, MessageBoxIcon.Error); _simAtm.BlockCard(); } else { MessageBox.Show("Wrong PIN-code. " + (_simAtm.attemptsAllowedPIN - _simAtm.attemptsPIN).ToString() + " attempts left.", "Wrong password", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } break; case ATM.State.MenuMain: _simAtm.WithdrawalMenu(); break; case ATM.State.MenuWithdrawal: CardForm form = new CardForm(_simAtm, "Input the amount that is a multiple of 10", 4); form.ShowDialog(); break; case ATM.State.MenuTransfer: //try //{ if (CardNumberBox.Text.Count() > 0 && AmountBox.Text.Count() > 0) _simAtm.CheckTransfer(CardNumberBox.Text, float.Parse(AmountBox.Text)); //} //catch (FormatException fe) //{ // DrawTransferResult(1); //} break; default: break; } }
private void CentralButton_Click(object sender, EventArgs e) { switch (CentralButton.Text) { case "Start ATM": uint sum; uint.TryParse(N20Box.Text, out sum); _simAtm.AddMoney(20, sum); uint.TryParse(N50Box.Text, out sum); _simAtm.AddMoney(50, sum); uint.TryParse(N100Box.Text, out sum); _simAtm.AddMoney(100, sum); uint.TryParse(N200Box.Text, out sum); _simAtm.AddMoney(200, sum); _simAtm.AcceptInput(ATM.InputType.OK); _simAtm.ReturnToIdle(); break; case "Insert card": CardForm form = new CardForm(_simAtm); form.ShowDialog(); break; case "Eject card": _simAtm.ReturnToIdle(); break; case "Main menu": _simAtm.MainMenu(); break; case "Proceed": _simAtm.MainMenu(); break; case "Walk away": _simAtm.ReturnToIdle(); break; } }