////////////////////////////////////////////////////////////////////
        // Print Example
        ////////////////////////////////////////////////////////////////////

        private void OnTableExample(object sender, EventArgs e)
        {
            ExceptionReport.Wrap("PDF Document creation falied", delegate
            {
                TableExample TE = new TableExample();
                TE.Test(DebugCheckBox.Checked, "TableExample.pdf");
                return;
            });
        }
        ////////////////////////////////////////////////////////////////////
        // Chart Example
        ////////////////////////////////////////////////////////////////////

        private void OnChartExample(object sender, EventArgs e)
        {
            ExceptionReport.Wrap("PDF Document creation falied", delegate
            {
                ChartExample CE = new ChartExample();
                CE.Test(DebugCheckBox.Checked, "ChartExample.pdf");
                return;
            });
        }
        ////////////////////////////////////////////////////////////////////
        // Print Example
        ////////////////////////////////////////////////////////////////////

        private void OnPrintExample(object sender, EventArgs e)
        {
            ExceptionReport.Wrap("PDF Document creation falied", delegate
            {
                PrintExample PE = new PrintExample();
                PE.Test(DebugCheckBox.Checked, "PrintExample.pdf");
                //			ProgramTestExample PTE = new ProgramTestExample();
                //			PTE.Test(DebugCheckBox.Checked, "ProgramTestExample.pdf");
                return;
            });
        }
        ////////////////////////////////////////////////////////////////////
        // Other example
        ////////////////////////////////////////////////////////////////////

        private void OnOtherExample
        (
            object sender,
            EventArgs e
        )
        {
            ExceptionReport.Wrap("PDF Document creation falied", delegate {
                OtherExample OE = new OtherExample();
                OE.Test(DebugCheckBox.Checked, "OtherExample.pdf");
                return;
            });
        }
        ////////////////////////////////////////////////////////////////////
        // Print Example
        ////////////////////////////////////////////////////////////////////

        private void OnTableExample(object sender, EventArgs e)
        {
            try
            {
                TableExample TE = new TableExample();
                TE.Test(DebugCheckBox.Checked, "TableExample.pdf");
                return;
            }

            catch (Exception Ex)
            {
                // error exit
                String[] ExceptionStack = ExceptionReport.GetMessageAndStack(Ex);
                MessageBox.Show(this, "PDF Document creation falied\n" + ExceptionStack[0] + "\n" + ExceptionStack[1],
                                "PDFDocument Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
        }
示例#6
0
        /////////////////////////////////////////////////////////////////////
        // Get exception message and exception stack
        /////////////////////////////////////////////////////////////////////


        public static void Wrap(string reason, Action fn)
        {
            // don't catch these exceptions if a debugger is attached
            if (System.Diagnostics.Debugger.IsAttached)
            {
                fn();
                return;
            }
            else
            {
                try {
                    fn();
                    return;
                } catch (Exception Ex) {
                    // error exit
                    String[] ExceptionStack = ExceptionReport.GetMessageAndStack(Ex);
                    MessageBox.Show(reason + "\n" + ExceptionStack[0] + "\n" + ExceptionStack[1],
                                    "TestPdfFileWriter Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
            }
        }