public void OpenFile_Click(object sender, EventArgs e) { openFileDialog.Filter = "CSV files (*.csv)|*.csv"; openFileDialog.ShowDialog(); string filedirectory = openFileDialog.FileName; string[] dump = filedirectory.Split('\\'); label_filename.Text = dump[dump.Length - 1]; filename = dump[dump.Length - 1]; string[] filenamePieces = filename.Split('.'); if (filenamePieces[filenamePieces.Length - 1] == "csv" | filenamePieces[filenamePieces.Length - 1] == openFileDialog.FileName) { bool ResourceConsumptionAtTime_Setting = DisplayResourceConsumptionAtTime.Checked; bool Makespan_Setting = DisplayMakespan.Checked; try { CurrentSettings.Add(new UserSettings(filedirectory, ResourceConsumptionAtTime_Setting, Makespan_Setting)); ChildForm = new ChartForm(this, CurrentSettings[CurrentSettings.Count - 1], filename); FormsList.Add(ChildForm); new Thread(() => ChildForm.ShowDialog()).Start(); } catch (Exception) { } } else { MessageBox.Show("The selected file is not a .csv file. Please select a .csv file."); Array.Clear(filenamePieces, 0, filenamePieces.Length - 1); } }
public void NewChartWindow_Click(object sender, EventArgs e) { CurrentSettings[CurrentSettings.Count - 1].ResourceConsumptionAtTime_Setting = DisplayResourceConsumptionAtTime.Checked; CurrentSettings[CurrentSettings.Count - 1].Makespan_Setting = DisplayMakespan.Checked; ChildForm = new ChartForm(this, CurrentSettings[CurrentSettings.Count - 1], filename); FormsList.Add(ChildForm); new Thread(() => ChildForm.ShowDialog()).Start(); }