Permalink
Browse files

2007-10-24 Ivan N. Zlatev <contact@i-nz.net>

        * Program.cs: More exception handling.
        * UI/NewFileDialog.cs: Usability improvements.


svn path=/trunk/mwf-designer/; revision=88086
  • Loading branch information...
1 parent 0552da5 commit 06028ed83ca44f3a0823ff14190897551e58426b @ivanz ivanz committed Oct 24, 2007
Showing with 23 additions and 5 deletions.
  1. +5 −0 ChangeLog
  2. +15 −5 src/Program.cs
  3. +3 −0 src/UI/NewFileDialog.cs
View
@@ -1,3 +1,8 @@
+2007-10-24 Ivan N. Zlatev <contact@i-nz.net>
+
+ * Program.cs: More exception handling.
+ * UI/NewFileDialog.cs: Usability improvements.
+
2007-09-26 Ivan N. Zlatev <contact@i-nz.net>
* DesignTime/CodeProviderDesignerLoader.cs: SetUIDirty to
View
@@ -12,16 +12,26 @@ static class Program
[STAThread]
static void Main()
{
- Application.EnableVisualStyles();
- Application.SetCompatibleTextRenderingDefault(false);
+ AppDomain.CurrentDomain.UnhandledException += delegate (object sender, UnhandledExceptionEventArgs args) {
+ if (args.ExceptionObject is Exception)
+ OnException ((Exception)args.ExceptionObject);
+ };
+
try {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainView());
} catch (Exception e) {
- MessageBox.Show ("A fatal error occured. Please file a bug report with the following details (Ctrl-C to copy to clipboard):" +
- System.Environment.NewLine + System.Environment.NewLine +
- e.ToString (), "Fatal Error");
+ OnException (e);
System.Windows.Forms.Application.Exit ();
}
}
+
+ private static void OnException (Exception e)
+ {
+ MessageBox.Show ("A fatal error occured. Please file a bug report with the following details (Ctrl-C to copy to clipboard):" +
+ System.Environment.NewLine + System.Environment.NewLine +
+ e.ToString (), "Fatal Error");
+ }
}
}
View
@@ -50,6 +50,8 @@ public NewFileDialog()
public NewFileDialog(string[] templateNames) : this ()
{
templatesListbox.Items.AddRange (templateNames);
+ if (templatesListbox.Items.Count >= 1)
+ templatesListbox.SelectedIndex = 0;
}
public string Class {
@@ -79,6 +81,7 @@ private void browseButton_Click(object sender, EventArgs e)
{
SaveFileDialog dialog = new SaveFileDialog();
dialog.OverwritePrompt = true;
+ dialog.Filter = "C# Source Code (*.cs)|*.cs| VB.NET Source Code (*.vb)|*.vb|Other|*.*";
if (dialog.ShowDialog() == DialogResult.OK)
filenameTextbox.Text = dialog.FileName;
}

0 comments on commit 06028ed

Please sign in to comment.