private void CarModel_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (CarModel.SelectedIndex == -1 || CarColor.SelectedIndex == -1 || CarEngine.SelectedIndex == -1 || CarType.SelectedIndex == -1 ) { return; } else { State s = State.getInstance(); CustomizeFactory f = new CustomizeFactory(); Car c; Car config = new Car(-1); Engine eng = new Engine(); eng.EngineType = (EEngine)CarEngine.SelectedIndex; config.Engine = eng; config.CarType = (ECarType)CarType.SelectedIndex; config.Model = (ECarModel)CarModel.SelectedIndex; f.configurations = config; c = f.GetCar(); CarPrice.Content = c.Price; CarAccesory.ItemsSource = c.Accessories; } }
private void Button_Click_2(object sender, RoutedEventArgs e) { if (CarModel.SelectedIndex == -1 || CarColor.SelectedIndex == -1 || CarEngine.SelectedIndex == -1 || CarType.SelectedIndex == -1 ) { return; } else { State s = State.getInstance(); CustomizeFactory f = new CustomizeFactory(); Car c; Car config = new Car(-1); Engine eng = new Engine(); eng.EngineType = (EEngine)CarEngine.SelectedIndex; config.Engine = eng; config.CarType = (ECarType)CarType.SelectedIndex; config.Model = (ECarModel)CarModel.SelectedIndex; f.configurations = config; c = f.GetCar(); CarPrice.Content = c.Price; CarAccesory.ItemsSource = c.Accessories; s.d.BuyCar(c); s.userCarlist.Add(c); Switcher.Switch(new ClientMenu()); } }