diff --git a/BooruDatasetTagManager/Form1.cs b/BooruDatasetTagManager/Form1.cs index c7a39c9..fc25b59 100644 --- a/BooruDatasetTagManager/Form1.cs +++ b/BooruDatasetTagManager/Form1.cs @@ -126,7 +126,7 @@ private void ColorManager_SchemeChanded(object sender, EventArgs e) } } - private void openFolderToolStripMenuItem_Click(object sender, EventArgs e) + private async void openFolderToolStripMenuItem_Click(object sender, EventArgs e) { if (Program.DataManager != null && Program.DataManager.IsDataSetChanged()) { @@ -141,7 +141,7 @@ private void openFolderToolStripMenuItem_Click(object sender, EventArgs e) return; isLoading = true; Program.DataManager = new DatasetManager(); - Program.DataManager.SetTranslationMode(isTranslate); + //Program.DataManager.SetTranslationMode(isTranslate); if (!Program.DataManager.LoadFromFolder(openFolderDialog.Folder)) { SetStatus(I18n.GetText("TipFolderWrong")); @@ -153,6 +153,7 @@ private void openFolderToolStripMenuItem_Click(object sender, EventArgs e) toolStripLabelAllTags.Text = I18n.GetText("UILabelAllTags"); gridViewAllTags.DataSource = Program.DataManager.AllTagsBindingSource; ApplyDataSetGridStyle(); + await ApplyTranslation(isTranslate); isLoading = false; gridViewDS.AutoResizeColumns(); } @@ -676,12 +677,17 @@ private void RemoveTagFromAll(bool filtered) private async void translateTagsToolStripMenuItem_Click(object sender, EventArgs e) { isTranslate = !isTranslate; - MenuItemTranslateTags.Checked = isTranslate; + await ApplyTranslation(isTranslate); + } + + private async Task ApplyTranslation(bool needTranslate) + { + MenuItemTranslateTags.Checked = needTranslate; if (Program.DataManager != null) { - Program.DataManager.SetTranslationMode(isTranslate); + Program.DataManager.SetTranslationMode(needTranslate); } - if (isTranslate) + if (needTranslate) { await FillTranslation(gridViewAllTags); await FillTranslation(gridViewTags);