private void btnInsertCoin2_Click(object sender, EventArgs e) { coinCode = Int32.Parse(txtCoinDoor.Text); if (activeCoins.IsActive(coinCode)) { pedDoor.Open(); } txtCoinDoor.Text = ""; }
public int DispenseCoin() { int number = r.Next(1, 10); while (coins.IsActive(number)) { number = r.Next(1, 10); } coins.AddCoin(number); return(number); }