private void btnMatchData_Click(object sender, EventArgs e) { try { if (!geoCoder.IsGazetteerInitialised()) { MessageBox.Show( "Gazetteer data missing, please read in a gazetteer file.", "Missing"); return; } if (geoCoder.InputData == null) { MessageBox.Show( "Input data missing, please read in an input file.", "Missing"); return; } SetColumnNames(); // disconnect the data grid untill the coding is complete dataGridView1.DataSource = null; Cursor = Cursors.WaitCursor; geoCoder.AddAllLocationCodes(); btnManualMatch.Enabled = true; DisplayData(); } catch (Exception ex) { ErrorHandler.Process( "A problem occurred with the data matching process.", ex); } finally { Cursor = Cursors.Default; } }
private void btnApplyAll_Click(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; matchInProgress = true; // remember the current row int selectedIndex = selectedRowIndex; // disconnect the data grids until the coding is complete dataGridView1.DataSource = null; parentGrid.DataSource = null; geoCoder.AddAllLocationCodes(); // reconect the data grids DisplayRecords(); parentGrid.DataSource = geoCoder.InputData; FormatGrid(parentGrid); // highlight the remembered row SelectRow(selectedIndex); DisplaySelectedRecord(); } catch (Exception ex) { ErrorHandler.Process( "Error refreshing the data.", ex); } finally { Cursor = Cursors.Default; matchInProgress = false; } }