Ejemplo n.º 1
0
 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
            }
        }
Ejemplo n.º 3
0
    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;
            }
        }
    }
Ejemplo n.º 4
0
 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;
 }
Ejemplo n.º 8
0
 /* Event Handlers */
 void printCoinRejected(object sender, CoinEventArgs e)
 {
     Console.WriteLine("Coin slot just rejected this coin: " + e.Coin);
 }
Ejemplo n.º 9
0
        private void coinSlot_AcceptCoin(object sender, CoinEventArgs e)
        {
            Cents cents = e.Coin.Value;

            funds += cents.Value;
        }
Ejemplo n.º 10
0
 public void CoinAccepted(object sender, CoinEventArgs e)
 {
     Console.WriteLine("Coin Slot accepted coin");
 }
Ejemplo n.º 11
0
 private void coinAdded(object sender, CoinEventArgs e)
 {
     // Increment counter
     insertedValue += e.Coin.Value;
 }
Ejemplo n.º 12
0
 static void c_CoinAccepted(object sender, CoinEventArgs e)
 {
     Console.WriteLine("Получено " + (e.Nominal / 100).ToString() + " руб.");
 }
Ejemplo n.º 13
0
 private void OnCoinChanged(object sender, CoinEventArgs e)
 {
     text.text = e.New.ToString();
 }
Ejemplo n.º 14
0
 private void insertSuccessful(object sender, CoinEventArgs e)
 {
     this.availableFunds += e.Coin.Value;
 }
Ejemplo n.º 15
0
 private void VendingMachineFactory_CoinAdded(object sender, CoinEventArgs e)
 {
     throw new NotImplementedException();
 }