Ejemplo n.º 1
0
 public UserViewModel(Dictionary<CoinTypes, CoinsViewModel> coins, MaсhineViewModel machine)
 {
     _vallet = new Dictionary<CoinTypes,CoinsViewModel>(coins);
     _machine = machine;
     foreach (var c in _vallet)
         c.Value.Choosed += InsertCoin;
 }
Ejemplo n.º 2
0
 public MainWindow()
 {
     //Типы монет,их названия и достоинство, товары,их названия и цена в идеале должны храниться в БД
     InitializeComponent();
     var coins = new Dictionary<CoinTypes, CoinsViewModel>();
     coins.Add(CoinTypes.One, new CoinsViewModel(CoinTypes.One, 100, "1 рубль"));
     coins.Add(CoinTypes.Two, new CoinsViewModel(CoinTypes.Two, 100, "2 рубля"));
     coins.Add(CoinTypes.Five, new CoinsViewModel(CoinTypes.Five, 100, "5 рублей"));
     coins.Add(CoinTypes.Ten, new CoinsViewModel(CoinTypes.Ten, 100, "10 рублей"));
     var goods = new Dictionary<GoodsTypes, GoodsViewModel>();
     goods.Add(GoodsTypes.Tea, new GoodsViewModel(GoodsTypes.Tea, 13, 10, "Чай"));
     goods.Add(GoodsTypes.Coffee, new GoodsViewModel(GoodsTypes.Coffee, 18, 20, "Кофе"));
     goods.Add(GoodsTypes.CoffeeMilk, new GoodsViewModel(GoodsTypes.CoffeeMilk, 21, 20, "Кофе с молоком"));
     goods.Add(GoodsTypes.Juice, new GoodsViewModel(GoodsTypes.Juice, 35, 15, "Сок"));
     Machine = new MaсhineViewModel(coins, goods);
     var userCoins = new Dictionary<CoinTypes, CoinsViewModel>();
     userCoins.Add(CoinTypes.One, new CoinsViewModel(CoinTypes.One, 10, "1 рубль"));
     userCoins.Add(CoinTypes.Two, new CoinsViewModel(CoinTypes.Two, 30, "2 рубля"));
     userCoins.Add(CoinTypes.Five, new CoinsViewModel(CoinTypes.Five, 20, "5 рублей"));
     userCoins.Add(CoinTypes.Ten, new CoinsViewModel(CoinTypes.Ten, 15, "10 рублей"));
     Machine.ConnectUser(new UserViewModel(userCoins,Machine));
     MainPanel.DataContext = Machine;
 }