From ac515347d0df94289847146487302ee0c783b866 Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Wed, 17 Oct 2007 11:33:11 +0000 Subject: [PATCH] Added ability to launch console applications. --- Source/Examples/ExampleLauncher.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Source/Examples/ExampleLauncher.cs b/Source/Examples/ExampleLauncher.cs index d7f62a05..8993ecee 100644 --- a/Source/Examples/ExampleLauncher.cs +++ b/Source/Examples/ExampleLauncher.cs @@ -92,8 +92,12 @@ namespace Examples } catch (Exception expt) { - MessageBox.Show(String.Format("{3}{0}Stacktrace:{0}{1}{0}{0}Inner exception:{0}{2}", - System.Environment.NewLine, expt.StackTrace, expt.InnerException, expt.Message), expt.Message); + if (expt.InnerException != null) + MessageBox.Show(expt.InnerException.ToString(), "An error has occured: \"" + expt.InnerException.Message + "\"", + MessageBoxButtons.OK, MessageBoxIcon.Warning); + else + MessageBox.Show(expt.ToString(), "An error has occured: \"" + expt.Message + "\"", + MessageBoxButtons.OK, MessageBoxIcon.Warning); } } @@ -139,10 +143,13 @@ namespace Examples expt.InnerException ), expt.Message); - - throw; } } + else + { + IExample ex = (IExample)example.GetConstructor(Type.EmptyTypes).Invoke(null); + ex.Launch(); + } GC.Collect(); GC.WaitForPendingFinalizers();