private void SimulateDays(int days) { // Instantiate the dialog box var dlg = new SimulWindow(); // Configure the dialog box dlg.Owner = this; var results = new SimulationResults(); var fcList = new FanControlsList(); foreach (var fc in fcList.Types()) { var result = SimulateDays((FanControl)Activator.CreateInstance(fc), days); results.Results.Add(result); } dlg.resultsGrid.ItemsSource = results.Results; // Open the dialog box modally dlg.ShowDialog(); }