Exemple #1
0
        private void buttonFind_Click(object sender, EventArgs e)
        {
            Sound.MakeSound("ButtonClick");
            List <LuxuryCar> luxuryCars    = new List <LuxuryCar>();
            XmlSerializer    xmlSerializer = new XmlSerializer(typeof(List <LuxuryCar>));

            using (Stream stream = File.OpenRead(@"..\..\XML\LuxuryCars.xml"))
            {
                luxuryCars = (List <LuxuryCar>)xmlSerializer.Deserialize(stream);
            }

            luxuryCar               = new LuxuryCar();
            luxuryCar.IsTv          = checkBoxTv.Checked;
            luxuryCar.IsAlcohol     = checkBoxAlcohol.Checked;
            luxuryCar.NumberOfSeats = Convert.ToInt32(numericUpDownAmountPeople.Value);

            for (int i = 0; i < luxuryCars.Count; ++i)
            {
                if ((luxuryCars[i].IsMatch(luxuryCar)) != null)
                {
                    luxuryCar = luxuryCars[i];
                    break;
                }
            }
            DialogResult = DialogResult.OK;
        }
Exemple #2
0
 public LuxuryCar IsMatch(LuxuryCar car)
 {
     if (IsTv == car.IsTv &&
         IsAlcohol == car.IsAlcohol &&
         this.NumberOfSeats >= car.NumberOfSeats &&
         this.taxist.IsWorking == false)
     {
         return(this);
     }
     else
     {
         return(null);
     }
 }
Exemple #3
0
 public TaxistLuxuryCarDetails(Car mainCar, bool isEnglish)
 {
     InitializeComponent();
     car = (LuxuryCar)mainCar;
     if (isEnglish)
     {
         labelAmountSeats.Text = "Amount seats:";
         checkBoxTv.Text       = "TV";
         checkBoxAlcohol.Text  = "Alcohol";
     }
     else
     {
         labelAmountSeats.Text = "К-сть сидінь:";
         checkBoxTv.Text       = "Телевізор";
         checkBoxAlcohol.Text  = "Алкоголь";
     }
 }