void printCoinAccepted(object sender, CoinEventArgs e) { // increment credit amount insertedAmount = insertedAmount + e.Coin.Value; //Console.WriteLine("Coin slot just accepted this coin: " + e.Coin); Console.WriteLine("Inserted value: " + insertedAmount); }
//=========This function Add the cents that user inserted and calculate it as funds private void coinAccepted(object sender, EventArgs args) { CoinEventArgs coinEventArgs = args as CoinEventArgs; //Set the coins event if (coinEventArgs != null) //if there are valid coins inserted { this.addFunds(coinEventArgs.Coin.Value); //Add the amount of the fund and record them in the coin slot } }
void printCoinLoaded(object sender, CoinEventArgs e) { // this code updates the software understanding of // the coin racks when the receptacle stores its // coins by listening to event, as it may go into // storage bin if coin rack full int coinValue = e.Coin.Value; Console.WriteLine("Coin rack loaded with: " + coinValue); CoinRack rack = (CoinRack)sender; // implement code here to update software coin rack // presume that receptacle always puts coins in right // racks, so the coin value indicates which rack foreach (SoftwareCoinRacks coinRack in softwareRacks) { if (coinRack.getValue() == coinValue) { coinRack.incQuantity(1); break; } } }
public void InsertCoin(Object sender, CoinEventArgs e) { credit += e.Coin.Value; }
// INTERNAL PROCESSING METHODS // If the coin is updated return the amount of money that has been inserted. private void updateCurrentBalance(object sender, CoinEventArgs e) { this.fundsAvailable += e.Coin.Value.Value; // A user action has been detected reset the error signal this.errorSignal = false; }
// INTERNAL PROCESSING METHODS // If the coin is updated return the amount of money that has been inserted. private void updateCurrentBalance(object sender, CoinEventArgs e) { this.fundsAvailable += e.Coin.Value.Value; }
void CoinSlot_CoinAccepted(object sender, CoinEventArgs e) { this.availableFunds += e.Coin.Value; }
/* Event Handlers */ void printCoinRejected(object sender, CoinEventArgs e) { Console.WriteLine("Coin slot just rejected this coin: " + e.Coin); }
private void coinSlot_AcceptCoin(object sender, CoinEventArgs e) { Cents cents = e.Coin.Value; funds += cents.Value; }
public void CoinAccepted(object sender, CoinEventArgs e) { Console.WriteLine("Coin Slot accepted coin"); }
private void coinAdded(object sender, CoinEventArgs e) { // Increment counter insertedValue += e.Coin.Value; }
static void c_CoinAccepted(object sender, CoinEventArgs e) { Console.WriteLine("Получено " + (e.Nominal / 100).ToString() + " руб."); }
private void OnCoinChanged(object sender, CoinEventArgs e) { text.text = e.New.ToString(); }
private void insertSuccessful(object sender, CoinEventArgs e) { this.availableFunds += e.Coin.Value; }
private void VendingMachineFactory_CoinAdded(object sender, CoinEventArgs e) { throw new NotImplementedException(); }