/// <summary> Imports the records from the indicated source file </summary> protected void Import_Records() { // Step through each constant map control Constant_Fields constantCollection = new Constant_Fields(); foreach (Constant_Assignment_Control thisConstant in constant_map_inputs) { constantCollection.Add(thisConstant.Mapped_Field, thisConstant.Mapped_Constant); } // METS files are not created from the MARC Importer; set flag to false. bool create_mets = false; bool deriveCopyrightStatusFromMARC = false; // validate the form if (!Validate_Import_MARC_Form()) { this.Enable_FormControls(); return; } // disable some of the form controls this.Disable_FormControls(); // Show the progress bar this.progressBar1.Visible = true; this.progressBar1.Maximum = 10; this.progressBar1.Value = 0; // reset the status label labelStatus.Text = ""; try { // Create the Processor and assign the Delegate method for event processing. processor = new MARC_Importer_Processor(this.sourceTextBox.Text, justSaveMarcXmlCheckBox.Checked, "", constantCollection, previewCheckBox.Checked, workingFolder + "\\ERROR"); processor.New_Progress += new New_Importer_Progress_Delegate(processor_New_Progress); processor.Complete += new New_Importer_Progress_Delegate(processor_Complete); // Create the thread to do the processing work, and start it. processThread = new Thread(new ThreadStart(processor.Do_Work)); processThread.SetApartmentState(ApartmentState.STA); processThread.Start(); } catch (Exception e) { // display the error message DLC.Tools.Forms.ErrorMessageBox.Show("Error encountered while processing!\n\n" + e.Message, "DLC Importer Error", e); // enable form controls on the Importer form this.Enable_FormControls(); this.Cursor = Cursors.Default; progressBar1.Value = progressBar1.Minimum; } }
/// <summary> Imports the records from the indicated source file </summary> protected void Import_Records() { // Step through each constant map control Constant_Fields constantCollection = new Constant_Fields(); foreach (Constant_Assignment_Control thisConstant in constant_map_inputs) { constantCollection.Add(thisConstant.Mapped_Field, thisConstant.Mapped_Constant); } // METS files are not created from the MARC Importer; set flag to false. bool create_mets = false; bool deriveCopyrightStatusFromMARC = false; // validate the form if (!Validate_Import_MARC_Form()) { this.Enable_FormControls(); return; } // disable some of the form controls this.Disable_FormControls(); // Show the progress bar this.progressBar1.Visible = true; this.progressBar1.Maximum = 10; this.progressBar1.Value = 0; // reset the status label labelStatus.Text = ""; try { // Create the Processor and assign the Delegate method for event processing. processor = new MARC_Importer_Processor(this.sourceTextBox.Text, justSaveMarcXmlCheckBox.Checked, "", constantCollection, previewCheckBox.Checked, workingFolder + "\\ERROR" ); processor.New_Progress += new New_Importer_Progress_Delegate(processor_New_Progress); processor.Complete += new New_Importer_Progress_Delegate(processor_Complete); // Create the thread to do the processing work, and start it. processThread = new Thread(new ThreadStart(processor.Do_Work)); processThread.SetApartmentState(ApartmentState.STA); processThread.Start(); } catch (Exception e) { // display the error message DLC.Tools.Forms.ErrorMessageBox.Show("Error encountered while processing!\n\n" + e.Message, "DLC Importer Error", e); // enable form controls on the Importer form this.Enable_FormControls(); this.Cursor = Cursors.Default; progressBar1.Value = progressBar1.Minimum; } }