void processor_Complete(int New_Progress) { // set the Cursor and ProgressBar back to default values. this.Cursor = Cursors.Default; this.progressBar1.Value = progressBar1.Minimum; // enable the form controls this.Enable_FormControls(); // Only continue if there are records already if (processor.Report_Data.Rows.Count == 0) { if (!justSaveMarcXmlCheckBox.Checked) { MessageBox.Show("No imported records! ", "Batch Importer", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { // Create a table to display the results DataTable displayTbl = processor.Report_Data.Copy(); // create the Results form Results_Form showResults = new Results_Form(processor.Report_Data, processor.Importer_Type, false); // hide the Importer form this.Hide(); // show the Results form showResults.ShowDialog(); // show the Importer form this.ShowDialog(); } }
void processor_Complete(int New_Progress) { // Check to see if Processor thread should be stopped if ((this.processor != null) && (this.processor.StopThread)) { try { // terminate the Processor thread processThread.Abort(); processThread.Join(); processor = null; } catch (System.Threading.ThreadAbortException) { // A ThreadAbortException has been invoked on the // Processor thread. Write the import data to an // Excel worksheet and update the form controls only // if the MainForm is not being disposed. // update the status controls on this form if (!this.Disposing) { labelStatus.Text = "Processing stopped at record " + (progressBar1.Value + 1).ToString("#,##0;") + " of " + progressBar1.Maximum.ToString("#,##0;") + " records"; progressBar1.Value = progressBar1.Minimum; this.Cursor = Cursors.Default; } try { // Create an Excel Worksheet named 'Output' on the input data file, // and write the importer results to the spreadsheet. Export_as_Excel(); } catch { } finally { // create a table to display the results DataTable displayTbl = this.processor.Report_Data.Copy(); // create the Results form Results_Form showResults = new Results_Form(displayTbl, processor.Importer_Type, previewCheckBox.Checked); // hide the Importer form this.Hide(); // show the Results form showResults.ShowDialog(); // enable form controls on the Importer form this.Enable_FormControls(); // show the Importer form this.ShowDialog(); } } catch { } } else { // The complete flag is true, set the Cursor and ProgressBar back to default values. this.Cursor = Cursors.Default; progressBar1.Value = progressBar1.Minimum; // disable the Stop button this.executeButton.Button_Enabled = false; try { // Create an Excel Worksheet named 'Output' on the input data file, // and write the importer results to the spreadsheet. Export_as_Excel(); } catch { } finally { // create a table to display the results DataTable displayTbl = this.processor.Report_Data.Copy(); // create the Results form Results_Form showResults = new Results_Form(displayTbl, processor.Importer_Type, previewCheckBox.Checked); // hide the Importer form this.Hide(); // show the Results form showResults.ShowDialog(); // enable form controls on the Importer form this.Enable_FormControls(); // show the Importer form this.ShowDialog(); } } }