////////////////////////////////////////////////////////////////////
        // 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;
            }
        }
Example #2
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;
                }
            }
        }