summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar stobies <unknown>2011-04-01 06:46:58 +0000
committerGravatar stobies <unknown>2011-04-01 06:46:58 +0000
commitdd270b5143e0f89abf8f5f80a747356b262b2f3a (patch)
treef54a09b55e5af77f8baebcb4afbab98ff8256c81
parentcebff25640d79c8b1ec3809917bde431abafe3c3 (diff)
Model viewer:
Display message box for exception during execution Allow to pass options to Main window constructor
-rw-r--r--Source/ModelViewer/Main.cs7
-rw-r--r--Source/ModelViewer/Program.cs9
2 files changed, 12 insertions, 4 deletions
diff --git a/Source/ModelViewer/Main.cs b/Source/ModelViewer/Main.cs
index e1dfe528..13bb1b95 100644
--- a/Source/ModelViewer/Main.cs
+++ b/Source/ModelViewer/Main.cs
@@ -37,7 +37,7 @@ namespace Microsoft.Boogie.ModelViewer
yield return Base.Provider.Instance;
}
- public Main()
+ public Main(string[] args)
{
InitializeComponent();
@@ -51,7 +51,6 @@ namespace Microsoft.Boogie.ModelViewer
var debugBreak = false;
string filename = null;
- var args = Environment.GetCommandLineArgs();
for (int i = 1; i < args.Length; i++) {
var arg = args[i];
if (arg == "/break" || arg == "-break")
@@ -63,7 +62,9 @@ namespace Microsoft.Boogie.ModelViewer
if (debugBreak) {
System.Diagnostics.Debugger.Launch();
}
- if (filename == null) {
+
+ if (filename == null)
+ {
throw new Exception("error: usage: ModelViewer.exe MyProgram.model[:N]"); // (where does this exception go?)
}
diff --git a/Source/ModelViewer/Program.cs b/Source/ModelViewer/Program.cs
index 3444fe9a..669ea995 100644
--- a/Source/ModelViewer/Program.cs
+++ b/Source/ModelViewer/Program.cs
@@ -15,7 +15,14 @@ namespace Microsoft.Boogie.ModelViewer
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
- Application.Run(new Main());
+ try
+ {
+ Application.Run(new Main(System.Environment.GetCommandLineArgs()));
+ }
+ catch (Exception exc)
+ {
+ MessageBox.Show(exc.Message, "Model Viewer Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
+ }
}
}
}