// constructor public KassenUI(Transaction transaction, CustomerUI customerUI) { this.tankstelle = Tankstelle.Current(); this.customerUI = customerUI; insertedMoney = new List <int>(); InitializeComponent(); this.transaction = transaction; Betrag.Content = transaction.GetCostInMoney().ToString("C2"); IReadOnlyList <int> coinValues = this.tankstelle.GetAvailableCoins(); foreach (int coinValue in coinValues) { Button button = new Button() { Content = ((decimal)coinValue / 100).ToString("C2"), FontSize = 20, Background = Brushes.LightGreen, Foreground = Brushes.Black, Margin = new Thickness(3) }; button.Click += (s, e) => { OnMoneyButton_Click(s, e, coinValue); }; MoneyPanel.Children.Add(button); } }
//Konstruktor public Payment(double Price, double Liter, Tankstelle tankstelle) { this.Preis = Price; this.Liter = Liter; this.Tankstelle = tankstelle; InitializeComponent(); }
// constructor public CustomerUI() { InitializeComponent(); this.tankstelle = Tankstelle.Current(); // TImer zum Anzeigen des Standes this.guiRefreshTimer = new DispatcherTimer(); guiRefreshTimer.Tick += (s, e) => { RefreshCurrentZapfsaeule(); }; this.guiRefreshTimer.Interval = TimeSpan.FromMilliseconds(100); this.guiRefreshTimer.Start(); }
// refreshes GUI // sets proper values to GUI items private void RefreshAllStats() { this.tankstelle = Tankstelle.Current(); TotalLastYearLabel.Content = tankstelle.GetYearStats().ToString("C2"); TotalLastMonthLabel.Content = tankstelle.GetMonthStats().ToString("C2"); TotalLastWeekLabel.Content = tankstelle.GetWeekStats().ToString("C2"); TotalTodayLabel.Content = tankstelle.GetTodaysMoneyStats().ToString("C2"); foreach (FuelType fuelType in tankstelle.GetAvailableFuelTypes()) { TextBlock textBlock = new TextBlock() { Text = fuelType.GetFuelTypeName() + ": " + tankstelle.GetTodaysLiterStats(fuelType) + "L\t" }; FuelTypePanel.Children.Add(textBlock); } }
//Konstruktor der Säule Holt Objekte welche Gebraucht werden und weist sie richtig zu public Säule(Zapfsäule zapfsäule, Tankstelle tankstelle) { InitializeComponent(); Benzin diesel = tankstelle.BenzinSorten.Find(t => t.Bezeichnung == "Diesel"); Benzin bleiFrei = tankstelle.BenzinSorten.Find(t => t.Bezeichnung == "Bleifrei"); Benzin super98 = tankstelle.BenzinSorten.Find(t => t.Bezeichnung == "Super98"); dieselTank = tankstelle.Tanks.Find(t => t.Bezeichnung == "DieselTank"); super98Tank = tankstelle.Tanks.Find(t => t.Bezeichnung == "Super98Tank"); bleifreiTank = tankstelle.Tanks.Find(t => t.Bezeichnung == "BleifreiTank"); BenzinPreisDiesel = diesel.getKostenproLiter(); BenzinPreisBleifrei = bleiFrei.getKostenproLiter(); BenzinPreisSuper98 = super98.getKostenproLiter(); TankBestabdDiesel = dieselTank.GetLiterBestand(); TankBestabdBleifrei = bleifreiTank.GetLiterBestand(); TankBestabSuper98 = super98Tank.GetLiterBestand(); this.tankstelle = tankstelle; }
//Konstruktor public Receipt(double Price, double Liter, double meineBezahlung, Tankstelle tankstelle) { this.Price = Math.Round(Price, 1); this.Liter = Liter; this.MeineBezahlung = Math.Round(meineBezahlung, 1); Tank dieselTank = tankstelle.Tanks.Find(t => t.Bezeichnung == "DieselTank"); Tank super98Tank = tankstelle.Tanks.Find(t => t.Bezeichnung == "Super98Tank"); Tank bleiferiTank = tankstelle.Tanks.Find(t => t.Bezeichnung == "BleifreiTank"); this.TankBestandDiesel = dieselTank.GetLiterBestand(); this.TankbestandBleifrei = bleiferiTank.GetLiterBestand(); this.TankBestandSuper98 = super98Tank.GetLiterBestand(); this.Tanks = tankstelle.Tanks; this.tankstelle = tankstelle; InitializeComponent(); }
// refreshes all data in page private void RefreshPage() { // initialize singleton this.tankstelle = Tankstelle.Current(); // Clear GUI FuelTankPanel.Children.Clear(); // Load Again foreach (FuelTank fuelTank in tankstelle.GetAvailableFuelTanks()) { Button fuelTankButton = new Button() { Content = fuelTank.GetFuelType().GetFuelTypeName() + " Tank", Margin = new Thickness(0, 1, 0, 1) }; // Set Function on Button fuelTankButton.Click += (s, e) => SelectFuelTank(fuelTank); FuelTankPanel.Children.Add(fuelTankButton); } }
// updates the page private void RefreshPage() { // Initializes singleton this.tankstelle = Tankstelle.Current(); // Clear GUI ZapfsaeulenPanel.Children.Clear(); ZapfhahnPanel.Children.Clear(); // Load Again foreach (Zapfsaeule zapfsaeule in tankstelle.GetAllZapfsauelen()) { Button zapfsaeuleButton = new Button() { Content = zapfsaeule.GetName(), Margin = new Thickness(0, 1, 0, 1) }; // Set Function on Button zapfsaeuleButton.Click += (s, e) => SelectZapfsauele(zapfsaeule); ZapfsaeulenPanel.Children.Add(zapfsaeuleButton); } }