Ejemplo n.º 1
0
        private void CallbackSaveDuplicateContentCsvReport(
            object sender,
            EventArgs e,
            MacroscopeCsvDuplicateContentReport.OutputWorksheet SelectedOutputWorksheet,
            string OutputFilename
            )
        {
            SaveFileDialog Dialog = new SaveFileDialog();

            Dialog.Filter           = "CSV files (*.csv)|*.csv|All files (*.*)|*.*";
            Dialog.FilterIndex      = 2;
            Dialog.RestoreDirectory = true;
            Dialog.DefaultExt       = "csv";
            Dialog.AddExtension     = true;
            Dialog.FileName         = OutputFilename;

            this.Enabled = false;

            if (Dialog.ShowDialog() == DialogResult.OK)
            {
                string Path = Dialog.FileName;
                MacroscopeTriplePercentageProgressForm ProgressForm;
                MacroscopeCsvDuplicateContentReport    CsvReport;

                ProgressForm = new MacroscopeTriplePercentageProgressForm(MainForm: this);

                CsvReport = new MacroscopeCsvDuplicateContentReport(
                    ProgressFormDialogue: ProgressForm
                    );

                try
                {
                    Cursor.Current = Cursors.WaitCursor;

                    CsvReport.WriteCsv(
                        JobMaster: this.JobMaster,
                        SelectedOutputWorksheet: SelectedOutputWorksheet,
                        OutputFilename: Path
                        );

                    Cursor.Current = Cursors.Default;
                }
                catch (MacroscopeSaveCsvFileException ex)
                {
                    this.DialogueBoxError("Error saving Duplicate Content CSV Report", ex.Message);
                }
                catch (Exception ex)
                {
                    this.DialogueBoxError("Error saving Duplicate Content CSV Report", ex.Message);
                }
                finally
                {
                    Cursor.Current = Cursors.Default;
                }
            }

            Dialog.Dispose();

            this.Enabled = true;
        }
        /** -------------------------------------------------------------------- **/

        private void CallbackSaveDuplicateContentExcelReport(object sender, EventArgs e)
        {
            SaveFileDialog Dialog = new SaveFileDialog();

            Dialog.Filter           = "Excel files (*.xlsx)|*.xlsx|All files (*.*)|*.*";
            Dialog.FilterIndex      = 2;
            Dialog.RestoreDirectory = true;
            Dialog.DefaultExt       = "xlsx";
            Dialog.AddExtension     = true;
            Dialog.FileName         = "Macroscope-Duplicate-Content.xlsx";

            this.Enabled = false;

            if (Dialog.ShowDialog() == DialogResult.OK)
            {
                this.Enabled = false;

                string Path;
                MacroscopeTriplePercentageProgressForm ProgressForm;
                MacroscopeExcelDuplicateContent        msExcelReport;

                Path          = Dialog.FileName;
                ProgressForm  = new MacroscopeTriplePercentageProgressForm(MainForm: this);
                msExcelReport = new MacroscopeExcelDuplicateContent(ProgressFormDialogue: ProgressForm);

                Cursor.Current = Cursors.WaitCursor;

                try
                {
                    msExcelReport.WriteXslx(JobMaster: this.JobMaster, OutputFilename: Path);
                }
                catch (MacroscopeSaveExcelFileException ex)
                {
                    this.DialogueBoxError("Error saving Duplicate Content Excel Report", ex.Message);
                }
                catch (Exception ex)
                {
                    this.DialogueBoxError("Error saving Duplicate Content Excel Report", ex.Message);
                }
                finally
                {
                    ProgressForm.DoClose();
                    Cursor.Current = Cursors.Default;
                }
            }

            if (Dialog != null)
            {
                Dialog.Dispose();
            }

            this.Enabled = true;
        }
Ejemplo n.º 3
0
        /** -------------------------------------------------------------------- **/

        private void CallbackSaveDuplicateContentExcelReport(object sender, EventArgs e)
        {
            SaveFileDialog Dialog = new SaveFileDialog();

            Dialog.Filter           = "Excel files (*.xlsx)|*.xlsx|All files (*.*)|*.*";
            Dialog.FilterIndex      = 2;
            Dialog.RestoreDirectory = true;
            Dialog.DefaultExt       = "xlsx";
            Dialog.AddExtension     = true;
            Dialog.FileName         = "Macroscope-Duplicate-Content.xlsx";

            if (Dialog.ShowDialog() == DialogResult.OK)
            {
                string Path = Dialog.FileName;

                MacroscopeTriplePercentageProgressForm ProgressForm = new MacroscopeTriplePercentageProgressForm(MainForm: this);

                MacroscopeExcelDuplicateContent msExcelReport = new MacroscopeExcelDuplicateContent(
                    ProgressFormDialogue: ProgressForm
                    );
                try
                {
                    if (Macroscope.MemoryGuard(RequiredMegabytes: ExcelReportMegabytesRamRequired))
                    {
                        Cursor.Current = Cursors.WaitCursor;
                        msExcelReport.WriteXslx(JobMaster: this.JobMaster, OutputFilename: Path);
                        Cursor.Current = Cursors.Default;
                    }
                }
                catch (MacroscopeInsufficientMemoryException ex)
                {
                    this.DialogueBoxError("Error saving Duplicate Content Excel Report", ex.Message);
                }
                catch (MacroscopeSaveExcelFileException ex)
                {
                    this.DialogueBoxError("Error saving Duplicate Content Excel Report", ex.Message);
                }
                catch (Exception ex)
                {
                    this.DialogueBoxError("Error saving Duplicate Content Excel Report", ex.Message);
                }
                finally
                {
                    ProgressForm.DoClose();
                    Cursor.Current = Cursors.Default;
                }
            }

            Dialog.Dispose();
        }