Skip to content
This repository has been archived by the owner on Oct 16, 2020. It is now read-only.

Commit

Permalink
Fix unhandled exception when creating WiX projects.
Browse files Browse the repository at this point in the history
Catch the InvalidProjectException thrown by the NewProjectDialog if WiX 3.6 is not installed.
  • Loading branch information
mrward committed Dec 17, 2012
1 parent 6c0f4bd commit 2566ff1
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/Main/Base/Project/Src/Gui/Dialogs/NewProjectDialog.cs
Expand Up @@ -6,12 +6,12 @@
using System.Drawing;
using System.IO;
using System.Windows.Forms;

using ICSharpCode.Core;
using ICSharpCode.Core.WinForms;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Internal.Templates;
using ICSharpCode.SharpDevelop.Project.Commands;
using Microsoft.Build.Exceptions;

namespace ICSharpCode.SharpDevelop.Project.Dialogs
{
Expand Down Expand Up @@ -296,7 +296,17 @@ string CheckProjectName(string solution, string name, string location)
return null;
}

void OpenEvent(object sender, EventArgs e)
void TryCreateProject(object sender, EventArgs e)
{
try {
CreateProject();
} catch (InvalidProjectFileException ex) {
LoggingService.Error("Unable to create new project.", ex);
MessageService.ShowError(ex.Message);
}
}

void CreateProject()
{
if (categoryTreeView.SelectedNode != null) {
PropertyService.Set("Dialogs.NewProjectDialog.LastSelectedCategory", TreeViewHelper.GetPath(categoryTreeView.SelectedNode));
Expand Down Expand Up @@ -431,7 +441,7 @@ protected void MyInitializeComponents()
smallIconsRadioButton.CheckedChanged += new EventHandler(IconSizeChange);
smallIconsRadioButton.Image = IconService.GetBitmap("Icons.16x16.SmallIconsIcon");

openButton.Click += new EventHandler(OpenEvent);
openButton.Click += new EventHandler(TryCreateProject);
browseButton.Click += new EventHandler(BrowseDirectories);
createDirectoryForSolutionCheckBox.CheckedChanged += new EventHandler(PathChanged);

Expand Down

0 comments on commit 2566ff1

Please sign in to comment.