private void MenuFileOpen_Click(object sender, EventArgs e)
{
if (openFileDialog.ShowDialog(this) == DialogResult.OK)
{
string filename = openFileDialog.FileName;
string extension = Path.GetExtension(filename);
if (extension == ".xls" || extension == ".xlsx")
{
ExcelReader db = new ExcelReader(filename, true, false);
TableSelectDialog t = new TableSelectDialog(db.GetWorksheetList());
if (t.ShowDialog(this) == DialogResult.OK)
{
this.dgvAnalysisSource.DataSource = db.GetWorksheet(t.Selection);
this.dgvProjectionSource.DataSource = db.GetWorksheet(t.Selection);
}
}
else if (extension == ".xml")
{
DataTable dataTableAnalysisSource = new DataTable();
dataTableAnalysisSource.ReadXml(openFileDialog.FileName);
this.dgvAnalysisSource.DataSource = dataTableAnalysisSource;
this.dgvProjectionSource.DataSource = dataTableAnalysisSource.Clone();
}
}
}