public StatusWindow(Status statusModel) { InitializeComponent(); DataContext = statusModel; statusModel.PropertyChanged += Test; }
public void RunGA() { // If no building is currently loaded then do nothing. if (String.IsNullOrEmpty(CurrentFile)) return; CurrentBuilding.ShortGenotype = _geneticsConfiguration.ShortGenotype; if (CurrentBuilding.ShortGenotype) { CurrentBuilding.Rooms .Where(x => x.NumberOfDoors == 1) .ToList() .ForEach(x => x.ApplySimpleEvacuation()); } GeneticsConfiguration<List<bool>> geneticsConfiguration = _geneticsConfiguration.BuildConfiguration(CurrentBuilding); _currentSimulation = new EvacuationSimulation(new Building(CurrentBuilding), geneticsConfiguration); _currentSimulation.GeneticAlgorithm.Completed += OnGeneticCompleted; // Create view model for presenting progression of algorithm. Status statusModel = new Status(_currentSimulation.GeneticAlgorithm); StatusWindow statusWindow = new StatusWindow(statusModel); // Run algorithm asynchronously. new Task(_currentSimulation.Start).Start(); statusWindow.ShowDialog(); }