private void btnCreateDatabase_Click(object sender, EventArgs e) { this.btnCreateDatabase.Enabled = false; try { var store = new TranslationStorageManager(); store.CreateDatabase(); MessageBox.Show(Properties.Resources.CreatedDatabaseSuccess); } catch (Exception ex) { if (log.IsErrorEnabled) log.Error("Creation of database failed. ", ex); MessageBox.Show(ex.Message); } this.btnCreateDatabase.Enabled = true; }
private void btnTest_Click(object sender, EventArgs e) { this.btnTest.Enabled = false; try { var store = new TranslationStorageManager(); if(store.DatabaseExists()) MessageBox.Show(Properties.Resources.TestConnectionSuccess); else MessageBox.Show(Properties.Resources.DatabaseNotExists); } catch (Exception ex) { if (log.IsErrorEnabled) log.Error("Testing of database connection failed. ", ex); MessageBox.Show(ex.Message); } this.btnTest.Enabled = true; }
private void storeAllTranslations() { if (CheckDatabase()) { try { setToolbarStatusText(Resources.StoringTranslations); TranslationStorageManager manager = new TranslationStorageManager(); if (!manager.DatabaseExists()) { manager.CreateDatabase(); } manager.Store(CurrentSolution); setToolbarStatusText(Resources.StoringTranslationsCompleted, 4000); } catch { resetToolbarStatusText(); throw; } finally { } } }
internal void fillTranslations() { if (CheckDatabase()) { try { setToolbarStatusText(Properties.Resources.SearchingTranslations); int process = 1; int found = 0; int max = CurrentSolution.Cultures.Count * (CurrentSolution.Cultures.Count - 1); var trans = new TranslationStorageManager(); foreach (VSCulture sourceCulture in CurrentSolution.Cultures.Values) { foreach (VSCulture targetCulture in CurrentSolution.Cultures.Values.Except(new VSCulture[] { sourceCulture })) { setToolbarStatusText(String.Format(Properties.Resources.SerachingTranslationsProcess, process, max)); List<ResourceDataBase> notexisting = sourceCulture.GetItemsNotExistingInCulture(targetCulture); foreach (var data in notexisting) { var result = trans.Search(data, targetCulture.Culture); if (result.Count() > 0) { found++; data.ResxFile.FileGroup.SetResourceData(data.Name, result.First().Text, targetCulture.Culture); } } process++; } } if (found > 0) this.solutionTree1.RefreshAnalysis(); setToolbarStatusText(String.Format(Properties.Resources.SearchingTranslationsResult, found), 4000); } catch { resetToolbarStatusText(); throw; } finally { } } }
internal int fillTranslations(VSCulture sourceCulture, VSCulture targetCulture) { int found = 0; try { setToolbarStatusText(Properties.Resources.SearchingTranslations); List<ResourceDataBase> notexisting = sourceCulture.GetItemsNotExistingInCulture(targetCulture); var trans = new TranslationStorageManager(); int process = 1; foreach (var data in notexisting) { setToolbarStatusText(String.Format(Properties.Resources.SerachingTranslationsProcess, process, notexisting.Count())); var result = trans.Search(data, targetCulture.Culture); if (result.Count() > 0) { found++; data.ResxFile.FileGroup.SetResourceData(data.Name, result.First().Text, targetCulture.Culture); } process++; } setToolbarStatusText(String.Format(Properties.Resources.SearchingTranslationsResult, found), 4000); } catch { resetToolbarStatusText(); throw; } finally { } return found; }