// When the start button is clicked, save the users selected university to a textfile, // Generate people for all universities, generate face images for those people, // Load the main form. private void startButton_Click(object sender, EventArgs e) { SelectPlayerUniversity(); GeneratePeople generatePeople = new GeneratePeople(databaseOperations); ImageCombiner combiner = new ImageCombiner(); Random rnd = new Random(); generatePeople.PopulateUniversities(); foreach (var uni in databaseOperations.Universities) { Console.WriteLine("Generating Faces for " + uni.Name); generatePeople.GenerateFaces(uni.ID, rnd, combiner); } //generatePeople.GenerateFaces(UniversityID, rnd, combiner); GoToMainScreen(); }
// Generates face images for all people in the database assosiated with given UniversityID. public void GenerateFaces(int uniid, Random rnd, ImageCombiner combiner) { List <int> peopleIDList = new List <int>(); foreach (var person in databaseOperations.People) { if (person.UniversityID == uniid) { peopleIDList.Add(person.ID); } } foreach (var personid in peopleIDList) { combiner.SelectRandomImageFromDirectories(rnd, personid); } peopleIDList.Clear(); peopleIDList.TrimExcess(); }