Beispiel #1
0
 /// <summary>
 ///     Refreshes the contents of labels
 /// </summary>
 private void RefreshUi()
 {
     PanelPurse.Title          = "Purse, " + Customer.Purse.Total;
     MachineMoneyDisplay.Title = "Money, " + Machine.Acceptor.Total;
     MachineMoneyDisplay.Update(Machine.Acceptor.GetMoneyString().Replace(Environment.NewLine, "<br />"));
     BalanceContainer.Update(Machine.Balance);
     X.Js.Call("UpdateButtons", new
     {
         CustomerButtons = Customer.Purse.Coins.Select(x => new
         {
             x.CoinValue,
             x.Count
         }),
         MachineButtons = from t in Machine.ProductTypes
                          from p in Machine.Products.Select(x => new { Id = x.Key, Count = x.Value })
                          .Where(x => x.Id == t.Id)
                          select new
         {
             t.Id,
             t.Name,
             t.Price,
             p.Count
         }
     });
 }
Beispiel #2
0
        public void PutCoin(int CoinValue)
        {
            if (Customer.Purse.IsCoinExists(CoinValue))
            {
                var Coins = Customer.Purse.Get(CoinValue);
                if (Coins.Length > 0)
                {
                    Machine.PushCoin(Coins[0].CoinValue);
                    BalanceContainer.Update(Machine.Balance);
                    LogWrite(string.Format("The coin value {0} thrown into the machine", CoinValue));
                }
            }
            else
            {
                MessageBox(string.Format("The coins value {0} ended", CoinValue));
            }

            RefreshUi();
        }