private void button1_Click(object sender, EventArgs e)
{
if (openFileDialog.ShowDialog() == DialogResult.OK) {
containingWizard.MapFileName = mapFileNameTextBox.Text = openFileDialog.FileName;
mapFileDisplay.Visible = true;
string errorMessageText;
float dpi; // not used here.
float mapScale;
MapType mapType;
Size bitmapSize;
RectangleF mapBounds;
if (MapUtil.ValidateMapFile(containingWizard.MapFileName, out mapScale, out dpi, out bitmapSize, out mapBounds, out mapType, out errorMessageText))
{
// map file is OK.
containingWizard.MapScale = mapScale;
containingWizard.MapType = mapType;
containingWizard.BitmapSize = bitmapSize;
containingWizard.mapBounds = mapBounds;
errorDisplayPanel.Visible = false;
infoDisplayPanel.Visible = true;
((Control)ParentForm.AcceptButton).Focus();
}
else {
// map file is not OK. Show message.
errorMessage.Text = errorMessageText;
infoDisplayPanel.Visible = false;
errorDisplayPanel.Visible = true;
}
}
}