private void OpenProject() { CloseProject(); OpenProjectFileDialog.Filter = "Traducciones|" + GetOpenProjectFilesFilter(); var result = OpenProjectFileDialog.ShowDialog(this); if (result == DialogResult.OK) { Project project = null; #if !DEBUG try { #endif Enabled = false; Cursor.Current = Cursors.WaitCursor; project = ProjectFactory.GetProject(OpenProjectFileDialog.FileName); project.LoadFiles(); project.LoadStrings(); Enabled = true; Cursor.Current = Cursors.Default; _openProject = project; LoadDataGrid(); Text = $"Translation Framework - {_openProject.Path}"; #if !DEBUG } catch (Exception e) { MessageBox.Show($"No se ha podido abrir el fichero.\r\n{e.GetType()}: {e.Message}", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); project?.Close(); Cursor.Current = Cursors.Default; Enabled = true; } #endif } }
private void OpenToolStripButton_Click(object sender, EventArgs e) { DialogResult result = OpenProjectFileDialog.ShowDialog(this); if (result == DialogResult.OK) { prj = osgGISProjects.XmlSerializer.loadProject(OpenProjectFileDialog.FileName); foreach (osgGISProjects.Source source in prj.getSources()) { string filename = source.getURI(); ILayerFactory layerFactory = null; if (!_layerFactoryCatalog.TryGetValue(Path.GetExtension(filename), out layerFactory)) { continue; } ILayer layer = layerFactory.Create(Path.GetFileNameWithoutExtension(filename), filename); addLayer(layer); } } }