public MainWindow() { #if !MINIMUM_MODE InitializeComponent(); DataContext = this; #endif _cargoShips = new CargoShipCollection(shipDataGrid); SeriesCollection = new SeriesCollection(); _containers = new ContainersCollection(); Tools.ContainerGenerator.Generate(); _containers.LoadCsv("DataInputGroupPT1440.csv"); _availableContainers = _containers.GetAvailable(_turn); for (int i = 0; i < 5; i++) { _cargoShips.Add(32, 30); } _cargoShips.DataGenStrategy = new IterativeStrategy(); #if MINIMUM_MODE Hide(); _ss = new SummaryScreen(); _ss.Show(); _cargoShips.DataGenStrategy = new GenAlgorithm(); // Make sure program closes after SS is closed _ss.SyncronizationClosedEvent += delegate { Close(); }; GenerateLoadingInstructions(); #else UpdatePie(); #endif }
private void btn_ship_Click(object sender, RoutedEventArgs e) { //Make sure that only one summary window exists _ss?.Close(); ((Button)sender).IsEnabled = false; new Task(GenerateLoadingInstructions).Start(); lbl_status.Content = "Instructions generation in process"; _ss = new SummaryScreen(); _ss.Show(); UpdateContainerCollection(); _turn++; _availableContainers = _containers.GetAvailable(_turn); //Tools.ContainerGenerator.Generate(); //_containers.LoadCsv("containers.csv", _turn); }