private void Grid_Loaded(object sender, RoutedEventArgs e) { //creating Bands #region Bands Band band1 = new RockBand("SlipKnot", new DateTime(1995, 8, 18), "Corey Taylor, Joey Jordison, Shawn Crahan, Sid Wilson"); Album Iowa = new Album("Iowa", RandomDate(band1.BandName), RandomSales()); band1.Albums.Add(Iowa); Band band2 = new RockBand("Metallica", new DateTime(1981, 8, 18), "James Hetfield, Kirk Hammett, Lars Ulrich"); Album JusticeForAll = new Album("... And Justice For All", RandomDate(band2.BandName), RandomSales()); band2.Albums.Add(JusticeForAll); Band band3 = new RockBand("MegaDeth", new DateTime(1983, 8, 18), "Dave Mustaine, Marty Friedman, Kiko Loureiro"); Album PeaceSells = new Album("Peace Sells", RandomDate(band3.BandName), RandomSales()); band3.Albums.Add(PeaceSells); Band band4 = new RockBand("Iron Maiden", new DateTime(1975, 8, 18), "Bruce Dickinson, Steve Harris, Paul Di'Anno"); Album NumberOfTheBeast = new Album("Number Of The Beast", RandomDate(band4.BandName), RandomSales()); band4.Albums.Add(NumberOfTheBeast); Band band5 = new PopBand("1D", new DateTime(2011, 8, 18), "Harry Styles, Zayn Malik, Louis Tomlinson, Niall Horan, Liam Payne"); Album UpAllNight = new Album("Up All Night", RandomDate(band5.BandName), RandomSales()); band5.Albums.Add(UpAllNight); Band band6 = new IndieBand("Linkin Park", new DateTime(1996, 8, 18), "Chester Bennington, Mike Shinoda, Joe Hahn"); Album Meteora = new Album("Meteora", RandomDate(band6.BandName), RandomSales()); band6.Albums.Add(Meteora); #endregion Bands combGenres.Items.Add("Rock"); combGenres.Items.Add("Pop"); combGenres.Items.Add("Indie"); //auto refrfreshable list //bands = new ObservableCollection<Band>(); //add bands too lists #region AddBands bands.Add(band1); bands.Add(band2); bands.Add(band3); bands.Add(band4); RockBands.Add(band1); RockBands.Add(band2); RockBands.Add(band3); RockBands.Add(band4); bands.Add(band5); PopBands.Add(band5); bands.Add(band6); Indiebands.Add(band6); #endregion AddBands //sort bands and add them too list bands.Sort(); lstbxBands.ItemsSource = bands; }
private void Window_Loaded(object sender, RoutedEventArgs e) { RockBand b1 = new RockBand() { BandName = "The Foo Fighters", YearFormed = 1994, Members = "Dave Grohl, Nate Mendel, Pat Smear, Taylor Hawkins, Chris Shifflett, Rami Jafee" }; RockBand b2 = new RockBand() { BandName = "The Rolling Stones", YearFormed = 1962, Members = "Mick Jagger, Ian Stewart, Dick Taylor, Bill Wymann, Mick Taylor" }; PopBand b3 = new PopBand() { BandName = "The Beatles", YearFormed = 1960, Members = "John Lennon, Paul McCartney, George Harrison, Ringo Starr" }; PopBand b4 = new PopBand() { BandName = "Green Day", YearFormed = 1986, Members = "Billie Joe Armstrong, Mike Dirnt, Tre Cool" }; IndieBand b5 = new IndieBand() { BandName = "Artic Monkeys", YearFormed = 2002, Members = "Alex Turner, Matt Heldens, Jamie Cook, Nick O'Malley" }; IndieBand b6 = new IndieBand() { BandName = "The Strokes", YearFormed = 1998, Members = "Julien Casablancas, Nick Valensi, Albert Hammond Jr, Nikolai Frature, Fabrizio Moretti" }; Random rand = new Random(); Album a1 = new Album() { Name = "Greatest Hits", YearOfRelease = rand.Next(1960, 2020), Sales = rand.Next(1000000, 10000000) }; Album a2 = new Album() { Name = "One by One", YearOfRelease = rand.Next(1960, 2020), Sales = rand.Next(1000000, 10000000) }; Album a3 = new Album() { Name = "Sticky Fingers", YearOfRelease = rand.Next(1960, 2020), Sales = rand.Next(1000000, 10000000) }; Album a4 = new Album() { Name = "Blue and Lonesome", YearOfRelease = rand.Next(1960, 2020), Sales = rand.Next(1000000, 10000000) }; Album a5 = new Album() { Name = "Sgt. Pepper's Lonely Hearts Club Band", YearOfRelease = rand.Next(1960, 2020), Sales = rand.Next(1000000, 10000000) }; Album a6 = new Album() { Name = "White Album", YearOfRelease = rand.Next(1960, 2020), Sales = rand.Next(1000000, 10000000) }; Album a7 = new Album() { Name = "Dookie", YearOfRelease = rand.Next(1960, 2020), Sales = rand.Next(1000000, 10000000) }; Album a8 = new Album() { Name = "American Idiot", YearOfRelease = rand.Next(1960, 2020), Sales = rand.Next(1000000, 10000000) }; Album a9 = new Album() { Name = "Whatever People Say I am, That's What I'm not", YearOfRelease = rand.Next(1960, 2020), Sales = rand.Next(1000000, 10000000) }; Album a10 = new Album() { Name = "Favourite Worst Nightmare", YearOfRelease = rand.Next(1960, 2020), Sales = rand.Next(1000000, 10000000) }; Album a11 = new Album() { Name = "Room on Fire", YearOfRelease = rand.Next(1960, 2020), Sales = rand.Next(1000000, 10000000) }; Album a12 = new Album() { Name = "The Modern Age", YearOfRelease = rand.Next(1960, 2020), Sales = rand.Next(1000000, 10000000) }; b1.AlbumList.Add(a1); b1.AlbumList.Add(a2); b2.AlbumList.Add(a3); b2.AlbumList.Add(a4); b3.AlbumList.Add(a5); b3.AlbumList.Add(a6); b4.AlbumList.Add(a7); b4.AlbumList.Add(a8); b5.AlbumList.Add(a9); b5.AlbumList.Add(a10); b6.AlbumList.Add(a11); b6.AlbumList.Add(a12); allBands.Add(b1); allBands.Add(b2); allBands.Add(b3); allBands.Add(b4); allBands.Add(b5); allBands.Add(b6); allBands.Sort(); lstbxBands.ItemsSource = allBands; }