diff --git a/EduNetworkBuilder/NetworkBuilder.cs b/EduNetworkBuilder/NetworkBuilder.cs index 009d01f..076ab45 100644 --- a/EduNetworkBuilder/NetworkBuilder.cs +++ b/EduNetworkBuilder/NetworkBuilder.cs @@ -1671,31 +1671,39 @@ namespace EduNetworkBuilder } //If it is a network file string extension = Path.GetExtension(filename).ToLower(); - //MessageBox.Show(filename + " " +extension); - if (extension == ".enbx") + //MessageBox.Show(filename + " " +extension); + try { - PrepForLoad(); - myNetwork.Load(filename); - UpdateMenu(); - UpdateForm(); - } else if(extension == ".enbu") - { - CurrentUser = new PersonClass(filename); - OurSettings = NB.GetSettings(); //Grab the new settings from the user - UpdateMenu(); + if (extension == ".enbx") + { + PrepForLoad(); + myNetwork.Load(filename); + UpdateMenu(); + UpdateForm(); + } + else if (extension == ".enbu") + { + CurrentUser = new PersonClass(filename); + OurSettings = NB.GetSettings(); //Grab the new settings from the user + UpdateMenu(); - //Now, open a new window to edit them. - PersonProfileForm PPF = new PersonProfileForm(CurrentUser); - CurrentUser = PPF.Edit(); //This does the form as dialog. When we come back, update the menu. - UpdateMenu(); + //Now, open a new window to edit them. + PersonProfileForm PPF = new PersonProfileForm(CurrentUser); + CurrentUser = PPF.Edit(); //This does the form as dialog. When we come back, update the menu. + UpdateMenu(); + } + else + { + MessageBox.Show(NB.Translate("NB_InvalidFile")); + Close(); + return; //We return here so we do not register the filename... + } + if (OurSettings != null) OurSettings.RegisterFileAsLoaded(filename); } - else + catch (Exception e) { - MessageBox.Show(NB.Translate("NB_InvalidFile")); - Close(); - return; //We return here so we do not register the filename... + MessageBox.Show("Error: " + e.ToString()); } - if (OurSettings != null) OurSettings.RegisterFileAsLoaded(filename); } private void loadRecentFilename(object sender, EventArgs e)