in src/IdFix/FormApp.cs [124:184]
private void InitRunner()
{
// Reset warning message flag
ValidTLDList.HasSeenMissingFileWarning = false;
// setup the background worker
runner = new RulesRunner();
runner.OnStatusUpdate += (string message) =>
{
// Update on main thread.
this.Invoke(new Action(() =>
{
statusDisplay(message);
}));
};
runner.RunWorkerCompleted += (object s, RunWorkerCompletedEventArgs args) =>
{
if (args.Error != null || args.Result is Exception)
{
if (args.Result is Exception)
{
MessageBox.Show((args.Result as Exception).Message);
}
else
{
MessageBox.Show(args.Error.Message);
}
}
else if (args.Cancelled)
{
statusDisplay(StringLiterals.CancelQuery);
}
else
{
firstRun = false;
this.Invoke(new Action(() =>
{
queryToolStripMenuItem.Enabled = true;
cancelToolStripMenuItem.Enabled = false;
acceptToolStripMenuItem.Enabled = true;
applyToolStripMenuItem.Enabled = true;
exportToolStripMenuItem.Enabled = true;
importToolStripMenuItem.Enabled = true;
undoToolStripMenuItem.Enabled = true;
// this should update the UI grid with all our error results
// also need to check for errors
var results = (RulesRunnerResult)args.Result;
// update status with final results
statusDisplay(string.Format("Total Elapsed Time: {0}s", results.TotalElapsed.TotalSeconds));
statusDisplay(string.Format("Total Entries Found: {0} Error Count: {1} Duplicates: {2} Skipped: {3}", results.TotalFound, results.TotalErrors, results.TotalDuplicates, results.TotalSkips));
// set the results on our grid which will handle filling itself
this.grid.SetFromResults(results);
this.SetPagingVisibility();
}));
}
};
}