private void Window_Loaded(object sender, RoutedEventArgs e) { comboBox1.Items.Add("All"); comboBox1.Items.Add("Rock"); comboBox1.Items.Add("Pop"); comboBox1.Items.Add("Indie"); comboBox1.SelectedItem = ("All"); Band Band1 = new RockBand("Blur", new DateTime(1989, 3, 27), "Damon Albarn, Alex James, Graham Coxon, Dave Rowntree"); Album Parklife = new Album("Parklife", RandomDate(Band1.Name), RandomSales()); Band1.Albums.Add(Parklife); Band Band2 = new RockBand("Muse", new DateTime(1994, 6, 11), "Matt Bellamy, Chris Wolstenholme, Dominic Howard"); Album Drones = new Album("Drones", RandomDate(Band2.Name), RandomSales()); Band2.Albums.Add(Drones); Band Band3 = new PopBand("A-ha", new DateTime(1982, 4, 7), "Morten Harket, Magne Furuholmen, Paul Waaktaar-Savoy"); Album Lifelines = new Album("Lifelines", RandomDate(Band3.Name), RandomSales()); Band3.Albums.Add(Lifelines); Band Band4 = new PopBand("Take That", new DateTime(1990, 11, 14), "Robbie Williams, Mark Owen, Howard Donald, Gary Barlow, Jason Orange"); Album Progress = new Album("Progress", RandomDate(Band4.Name), RandomSales()); Band4.Albums.Add(Progress); Band Band5 = new IndieBand("Bloc Party", new DateTime(1999, 2, 17), "Gordon Moakes, Russell Lissack, Kele Okereke"); Album Hymns = new Album("Hymns", RandomDate(Band5.Name), RandomSales()); Band5.Albums.Add(Hymns); Band Band6 = new IndieBand("Arcade Fire", new DateTime(2001, 5, 21), "Win Butler, Richard Reed Parry, Matt Bauder, William Butler, Jeremey Gara, Howard Bilerman, Tim Kingsbury"); Album Funeral = new Album("Funeral", RandomDate(Band6.Name), RandomSales()); Band6.Albums.Add(Funeral); allBands.Add(Band1); allBands.Add(Band2); allBands.Add(Band3); allBands.Add(Band4); allBands.Add(Band5); allBands.Add(Band6); allBands.Sort(); RockBands.Add(Band1); RockBands.Add(Band2); PopBands.Add(Band3); PopBands.Add(Band4); IndieBands.Add(Band5); IndieBands.Add(Band6); lbxBands.ItemsSource = allBands; }
public List <Band> CreateBands() //method to create and return the list of bands { //band objects are created Band B1 = new PopBand() { BandName = "Shpongle", YearFormed = 1996, Members = "Simon Posford, Raja Ram", }; Band B2 = new PopBand() { BandName = "Younger Brother", YearFormed = 2003, Members = "Simon Posford, Benji Vaughan", }; Band B3 = new RockBand() { BandName = "Muse", YearFormed = 1994, Members = "Matt Bellamy, Chris Wolstenholme, Dominic Howard", }; Band B4 = new IndieBand() { BandName = "Primal Scream", YearFormed = 1982, Members = "Bobby Gillespie, Andrew Innes, Martin Duffy, Darrin Mooney, Simone Butler", }; Band B5 = new IndieBand() { BandName = "The Stone Roses", YearFormed = 1983, Members = "Ian Brown, John Squire, Mani, Reni", }; Band B6 = new RockBand() { BandName = "DreadZone", YearFormed = 1993, Members = "Steve Roberts, Dan Donavan, Chris Oldfield, Ben Balafonic", }; //add the above bands to the bands list bands.Add(B1); bands.Add(B2); bands.Add(B3); bands.Add(B4); bands.Add(B5); bands.Add(B6); //return the completed list return(bands); }