private void saveToolStripMenuItem_Click(object sender, EventArgs e) { var lstModInfos = _gridUiHelper.ParseAllTables(); bool success; try { // start the process WaitingForm.ShowForm(this); success = TranslationManager.SaveGridData(_configHelper.GetLastPathOfDataFiles(), lstModInfos); WaitingForm.CloseForm(); } catch (Exception exception) { Logger.Log(exception.Message); throw; } if (success) { Logger.Log(Resources.GridUI_saveToolStripMenuItem_Click_Successfully_saved); } }
private void StartParsingProcess(string folderName) { try { // start the process WaitingForm.ShowForm(this); var tc = TranslationManager.GetGridData(new DirectoryInfo(folderName)); if (tc == null) { WaitingForm.CloseForm(); MessageBox.Show(Resources.GridUI_No_stringtable_xml_files_found); return; } SuspendLayout(); tabControl1.Hide(); _gridUiHelper = new GridUiHelper(this); _gridUiHelper.Cleanup(); _gridUiHelper.ShowData(tc); ResumeLayout(); tabControl1.Show(); WaitingForm.CloseForm(); saveToolStripMenuItem.Enabled = true; findToolStripMenuItem.Enabled = true; addLanguageToolStripMenuItem.Enabled = true; statisticsToolStripMenuItem.Enabled = true; _configHelper.SetLastPathOfDataFiles(new DirectoryInfo(folderName)); _stringtablesLoaded = true; } catch (AggregateException ae) { foreach (var ex in ae.Flatten().InnerExceptions) { if (ex is DuplicateKeyException duplicateKeyException) { MessageBox.Show(string.Format(Resources.GridUI_Duplicate_key_found, duplicateKeyException.KeyName, duplicateKeyException.FileName, duplicateKeyException.EntryName), Resources.GridUI_Duplicate_key_found_title); } if (ex is GenericXmlException xmlException) { MessageBox.Show(string.Format(Resources.GridUI_Generic_xml_exception, xmlException.KeyName, xmlException.FileName, xmlException.EntryName), Resources.GridUI_Generic_xml_exception_title); } } } }