// fill fuel into selected fuel tank private void FillTankButton_Click(object sender, RoutedEventArgs e) { int amountOfFuel; if (!string.IsNullOrEmpty(FuelTankBox.Text) && int.TryParse(FuelTankBox.Text, out amountOfFuel) && !FuelTankBox.Text.Contains('-') && selectedFuelTank != null) { selectedFuelTank.AddFuelToTank(amountOfFuel); tankstelle.SaveFuelTanks(); SelectFuelTank(selectedFuelTank); FuelTankBox.Text = ""; } }