private void CreateVanObjects(Random random, int numOfObjects) { Van[] vanArray = new Van[numOfObjects]; for (int i = 0; i < numOfObjects; i++) { vanArray[i] = new Van(Van.GetVehicleMake(random), Van.GetVehicleModel(random), (VanType)random.Next(6), random.Next(10000, 30000), GetRandomYear(), random.Next(300000), random.Next(10, 30), (WheelBase)random.Next(4), "Nice vehicle", GetRandomColour(), "/images/all1.png", "vanV.jpg"); vehicleCollection.Add(vanArray[i]); } }
private void GetVehicleType() { if (vehicle.GetType().Name == "Car") { tempcar = (Car)vehicle; } else if (vehicle.GetType().Name == "Van") { tempvan = (Van)vehicle; } else if (vehicle.GetType().Name == "Bike") { tempbike = (Bike)vehicle; } }
private void CreateNewVehicle() { string type = comboAddVehicle.SelectedItem.ToString(); if (type == "Car") { tempcar = new Car(model, make, CarBodyType.Convertible, price, year, mileage, 0, description, color, "/images/all1.png", imageName); } else if (type == "Van") { tempvan = new Van(model, make, VanType.Dropside, price, year, mileage, 0, WheelBase.Short, description, color, "/images/all1.png", imageName); } else if (type == "Bike") { tempbike = new Bike(model, make, BikeType.Commuter, price, year, mileage, 0, description, color, "/images/all1.png", imageName); } }
private void rbnVans_Checked(object sender, RoutedEventArgs e) { vanType.Clear(); //loop through foreach (var vanVehicle in vehicleType) { //if type is van if (vanVehicle.GetType().Name.Equals("Van")) { //add to filter, needs to be converted first Van v = vanVehicle as Van; vanType.Add(v); } } lbxDisplay.ItemsSource = vanType; }