private void Click_ContinuePreviousSimulation(object sender, RoutedEventArgs e) { HarbourAdministration.CreatePreviousHarbourAndBoats(HarbourAdministration.ReadInformationFromFile()); CreateAndDisplayPicturesExeptForRowingBoat(); CreateDisplayRowingBoatPictures(); NumberOfBoatsPerDay.Text = Counter.NumberOfNewBoatsPerUdate.ToString(); PrintInfoHarbour(); PrintInfoNorthHarbour(); PrintInfoSouthHarbor(); }
public void PrintInfoHarbour() { List <String> info = HarbourAdministration.StringInfo(); InformationHarbour.Text = ""; foreach (var item in info) { InformationHarbour.Text += item; } }
private void RunProgram(int numberOfDays) { int count = 0; while (count < numberOfDays) { Counter.NumberOfDeclinedBoatsEachDay = 0; Harbour.DecreaseDaysLeftForBoatsAtWharf(); Harbour.BoatsInHarbour = Harbour.DecreaseDaysLeftForBoatsInHarbour(); HarbourAdministration.BoatsComingToHarbour = Boat.CreateNewBoats(Counter.NumberOfNewBoatsPerUdate); HarbourAdministration.DeclinedBoats = new List <Boat>(); foreach (var boat in HarbourAdministration.BoatsComingToHarbour) { bool placeFree = boat.IsTherePLaceForBoatInHarbour(); if (placeFree) { int bestPlace = boat.CheckForBestPlaceInHarbour(); boat.PlaceBoatAtWharf(bestPlace); Harbour.BoatsInHarbour.Add(boat); } else { HarbourAdministration.DeclinedBoats.Add(boat); Counter.NumberOfDeclinedBoatsEachDay++; } } Counter.NumberOfDeclinedBoatsSinceStartOfSimulation += Counter.NumberOfDeclinedBoatsEachDay; Counter.DaysSinceStartOfSimulation++; if (Counter.DaysSinceStartOfSimulation > 0) { PreviousSimulation.Visibility = Visibility.Hidden; } count++; } CreateAndDisplayPicturesExeptForRowingBoat(); CreateDisplayRowingBoatPictures(); PrintInfoHarbour(); PrintInfoNorthHarbour(); PrintInfoSouthHarbor(); HarbourAdministration.WriteInformationToFile(Harbour.WharfPlacesInHarbour, Harbour.BoatsInHarbour); }