示例#1
0
 // for setting GUI properly
 public void SetZapfhahnValues(Zapfsaeule selectedZapfsaeule, Zapfhahn selectedZapfhahn, CustomerSimulation customerSimulation)
 {
     this.customerSimulation = customerSimulation;
     this.selectedZapfsaeule = selectedZapfsaeule;
     this.selectedZapfhahn   = selectedZapfhahn;
     this.selectedFuelType   = selectedZapfhahn.GetFuelType();
     // Transaction vo de Zapfsüle wo im GUI slektiert isch
     SelectedFuelLabel.Content  = selectedZapfhahn.GetFuelType().GetFuelTypeName();
     CostPerLiterTextBlock.Text = $"{(decimal)selectedZapfhahn.GetFuelType().GetCostPerLiterInCent() / 100}.-";
     CostBox.Text  = this.selectedZapfsaeule.GetCurrentTransactionFuelAmount() * (decimal)this.selectedZapfhahn.GetFuelType().GetCostPerLiterInCent() / 100 + ".-";
     LiterBox.Text = this.selectedZapfsaeule.GetCurrentTransactionFuelAmount() + " L";
     if (this.selectedZapfsaeule.isTanking())
     {
         TakeFuel.Content = "Stop";
     }
     else if (this.selectedZapfsaeule.isLocked())
     {
         TakeFuel.Content    = "Go pay";
         TakeFuel.Background = Brushes.LightGray;
         TakeFuel.IsEnabled  = false;
     }
     else if (selectedZapfsaeule.isLocked() == false)
     {
         TakeFuel.Content = "Start Tanking";
         TakeFuel.ClearValue(BackgroundProperty);
         TakeFuel.IsEnabled = true;
     }
     RefreshTransactions();
 }
示例#2
0
        // on selection of gas pump
        public void SelectZapfsauele(Zapfsaeule zapfsaeule)
        {
            // überprüfen ob der Zapfhhan bereits läuft oder nicht. Wenn ja Schnellanzeige

            // set selection and clear children
            this.selectedZapfsaeule = zapfsaeule;
            ZapfhahnPanel.Children.Clear();

            bool isLocked = true;

            if (!zapfsaeule.isLocked())
            {
                isLocked = false;
                CustomerUIFrame.Content = new DisplayWelcome("Chose your gas nozzle", "", new Uri("../Images/Zapfhahn.png", UriKind.Relative));
            }
            // set new Zapfhaehne
            foreach (Zapfhahn zapfhahn in zapfsaeule.GetZapfhaene())
            {
                Button zapfhahnButton = new Button()
                {
                    Content   = zapfhahn.GetFuelType().GetFuelTypeName(),
                    MinWidth  = 50,
                    Margin    = new Thickness(1),
                    IsEnabled = !isLocked
                };
                if (isLocked)
                {
                    zapfhahnButton.Background = Brushes.LightGray;
                }
                // set Function to Button
                zapfhahnButton.Click += (s, e) => SelectZapfhahn(zapfhahn);
                ZapfhahnPanel.Children.Add(zapfhahnButton);
            }
            if (isLocked && selectedZapfsaeule.GetSelectedZapfhahn() != null)
            {
                SelectZapfhahn(selectedZapfsaeule.GetSelectedZapfhahn());
            }
        }