예제 #1
0
        private void AddNewCar_Click(object sender, RoutedEventArgs e)
        {
            AddCarWindow addCar = new AddCarWindow();

            addCar.Owner = this;
            addCar.Show();
        }
예제 #2
0
        private void ChangeBT_Click(object sender, RoutedEventArgs e)
        {
            //MessageBox.Show(index.ToString());
            CarC carToChange = new CarC();

            foreach (Cars z in db.Cars)
            {
                if (z.CarID == index)
                {
                    carToChange = new CarC {
                        IndexC = z.CarID, MarkC = z.mark, ProducerC = z.producer, CostC = (int)z.cost, YearC = (int)z.year, ColorC = z.color, FileName = z.photo
                    };
                }
            }

            AddCarWindow changeCar = new AddCarWindow();

            changeCar.MarkCB.SelectedItem  = carToChange.MarkC;
            changeCar.Color_TB.Text        = carToChange.ColorC;
            changeCar.YearCB.SelectedItem  = carToChange.YearC;
            changeCar.CostTB.Text          = carToChange.CostC.ToString();
            changeCar.FilePathTB.Text      = carToChange.FileName;
            changeCar.AddCarButton.Content = "CHANGE";
            changeCar.add   = false;
            changeCar.index = index;

            changeCar.Owner = MainWindow.ownt;


            changeCar.ShowDialog();
        }