internal static ProjectId CreateNewProject(Form dialogOwner, FwApp app, IHelpTopicProvider helpTopicProvider)
{
using (var dlg = new FwNewLangProject())
{
dlg.SetDialogProperties(helpTopicProvider);
switch (dlg.DisplayDialog(dialogOwner))
{
case DialogResult.OK:
if (dlg.IsProjectNew)
return new ProjectId(dlg.GetDatabaseFile(), null);
else
{
// The user tried to create a new project which already exists and
// then choose to open the project. Therefore open the project and return
// null for the ProjectId so the caller of this method does not try to
// create a new project.
ProjectId projectId = new ProjectId(dlg.GetDatabaseFile(), null);
OpenExistingProject(projectId, app, dialogOwner);
return null;
}
case DialogResult.Abort:
// If we get an Abort it means that we got an exception in the dialog (e.g.
// in the OnLoad method). We can't just catch that exception here (probably
// because of the extra message loop the dialog has), so we close the dialog
// and return Abort.
MessageBox.Show(dialogOwner,
ResourceHelper.GetResourceString("kstidNewProjError"),
ResourceHelper.GetResourceString("kstidMiscError"));
break;
}
}
return null;
}