private void ImportFromPoFiles() { if (_project != null) { FolderBrowserDialog.Description = "Selecciona la carpeta raiz con los ficheros Po"; FolderBrowserDialog.ShowNewFolderButton = false; var formResult = FolderBrowserDialog.ShowDialog(this); if (formResult == DialogResult.Cancel) { return; } var workForm = new WorkingForm(dockTheme, "Importar Po"); workForm.DoWork += (sender, args) => { var worker = sender as BackgroundWorker; try { _project.ImportPo(FolderBrowserDialog.SelectedPath, worker); worker.ReportProgress(-1, "FINALIZADO"); worker.ReportProgress(-1, string.Empty); } catch (UserCancelException e) { args.Cancel = true; } #if !DEBUG catch (Exception e) { worker.ReportProgress(0, $"ERROR: {e.Message}"); } #endif }; workForm.ShowDialog(this); } }
private void ImportTexts() { if (_project != null) { if (_currentFile != null) { if (_currentFile.NeedSaving) { var result = MessageBox.Show( "Es necesario guardar los cambios antes de continuar.\n¿Quieres guardarlos?", "Guardar cambios", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.No) { return; } if (result == DialogResult.Yes) { _currentFile.SaveChanges(); } } } FolderBrowserDialog.Description = "Selecciona la carpeta raiz con los ficheros Po"; FolderBrowserDialog.ShowNewFolderButton = false; var formResult = FolderBrowserDialog.ShowDialog(this); if (formResult == DialogResult.Cancel) { return; } var openFile = _currentFile; ExplorerOnFileChanged(null); var workForm = new WorkingForm(dockTheme, "Importar Po"); workForm.DoWork += (sender, args) => { var worker = sender as BackgroundWorker; try { _project.ImportPo(FolderBrowserDialog.SelectedPath, worker); worker.ReportProgress(-1, "FINALIZADO"); worker.ReportProgress(-1, string.Empty); } catch (UserCancelException e) { args.Cancel = true; } #if !DEBUG catch (Exception e) { worker.ReportProgress(0, $"ERROR: {e.Message}"); } #endif }; workForm.ShowDialog(this); ExplorerOnFileChanged(openFile); } }