Ejemplo n.º 1
0
        private void itemImportStrings_Click(object sender, EventArgs e)
        {
            try
            {
                if (currentFile == null)
                {
                    MessageBox.Show("First select the file!", "ToradoraTranslateTool", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                using (OpenFileDialog myOpenFileDialog = new OpenFileDialog())
                {
                    myOpenFileDialog.Filter = "Xlsx table (*.xlsx) | *.xlsx";
                    if (myOpenFileDialog.ShowDialog() == DialogResult.OK)
                    {
                        FormImport myForm = new FormImport();
                        if (myForm.ShowDialog() == DialogResult.OK)
                        {
                            ImportText(myOpenFileDialog.FileName, myForm.Column, myForm.Cell);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error!" + Environment.NewLine + ex.ToString(), "ToradoraTranslateTool", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 2
0
        private void itemImportAll_Click(object sender, EventArgs e)
        {
            try
            {
                using (var myFolderDialog = new FolderBrowserDialog())
                {
                    if (myFolderDialog.ShowDialog() == DialogResult.OK)
                    {
                        FormImport myForm = new FormImport();
                        if (myForm.ShowDialog() == DialogResult.OK)
                        {
                            for (int i = 1; i < dataGridViewFiles.RowCount; i++)
                            {
                                string objName      = dataGridViewFiles[0, i].Value.ToString();
                                string xlsxFilename = Path.Combine(myFolderDialog.SelectedPath, Path.GetFileNameWithoutExtension(objName) + ".xlsx");
                                if (File.Exists(xlsxFilename))
                                {
                                    dataGridViewFiles.ClearSelection(); // Select and scroll to the current file to show progress
                                    dataGridViewFiles.Rows[i].Selected = true;
                                    dataGridViewFiles.CurrentCell      = dataGridViewFiles.Rows[i].Cells[0];

                                    LoadFile(objName);
                                    ImportText(xlsxFilename, myForm.Column, myForm.Cell);
                                    Application.DoEvents();
                                }
                            }
                        }
                        myForm.Dispose();

                        MessageBox.Show("Done!", "ToradoraTranslateTool", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error!" + Environment.NewLine + ex.ToString(), "ToradoraTranslateTool", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }