Skip to content

Commit

Permalink
Fixed loading dataset when translation enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
starik222 committed Oct 24, 2024
1 parent f1ca4bf commit fbbf5a9
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions BooruDatasetTagManager/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
{
Expand All @@ -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"));
Expand All @@ -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();
}
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit fbbf5a9

Please sign in to comment.