public void LoadTemplate(FileInfo template) { //redundant condition checking if (template.Exists == false) { return; } // template doesn't exist do nothing.. if (_templateFile != null) { return; } //template already set, don't reload if (_fileHasTemplate == true) { return; } _templateFile = template; //insert meta data containing location of template file _database.WriteGlobalValue("CSM", "TemplatePath", template.FullName); try { _templateDatabase = new DAL(template.FullName); //only load FIX and PNT Cruise methods for Recon cruises CruiseMethods = _templateDatabase.GetCruiseMethods(this.Sale.Purpose == "Recon"); this.StartAsynCopyTemplate(_templateDatabase); } catch (Exception) { MessageBox.Show("Error: Couldn't open template"); } finally { if (_templateDatabase != null) { _templateDatabase.Dispose(); _templateDatabase = null; } } }