diff --git a/I18N Commander/UI WinForms/Components/Translation.cs b/I18N Commander/UI WinForms/Components/Translation.cs index c1b093b..6bd5590 100644 --- a/I18N Commander/UI WinForms/Components/Translation.cs +++ b/I18N Commander/UI WinForms/Components/Translation.cs @@ -1,4 +1,5 @@ using System.Timers; +using DataModel.Database; using Processor; using Timer = System.Timers.Timer; @@ -31,6 +32,12 @@ public sealed partial class Translation : UserControl AutoReset = false, // runs only once }; this.saveTimer.Elapsed += this.SaveChanges; + this.Load += async (sender, args) => await this.LateSetup(); + } + + private async Task LateSetup() + { + this.buttonDeepL.Visible = await AppSettings.GetDeepLMode() != SettingDeepLMode.DISABLED; } private async void SaveChanges(object? sender, ElapsedEventArgs e) @@ -39,7 +46,7 @@ public sealed partial class Translation : UserControl await TranslationProcessor.SaveChangedTranslation(this.currentTranslationId, this.textBox.Text); } - public void Configure(DataModel.Database.Translation translation) + public async Task Configure(DataModel.Database.Translation translation) { this.isLoading = true; @@ -47,6 +54,7 @@ public sealed partial class Translation : UserControl this.textBox.Text = translation.Text; this.textBox.Multiline = translation.TextElement.IsMultiLine; this.Height = translation.TextElement.IsMultiLine ? 280 : 106; + this.buttonDeepL.Visible = await AppSettings.GetDeepLMode() != SettingDeepLMode.DISABLED; this.isLoading = false; } diff --git a/I18N Commander/UI WinForms/Components/Translations.cs b/I18N Commander/UI WinForms/Components/Translations.cs index 70f6d13..5d8e7fc 100644 --- a/I18N Commander/UI WinForms/Components/Translations.cs +++ b/I18N Commander/UI WinForms/Components/Translations.cs @@ -15,7 +15,7 @@ public partial class Translations : UserControl var allTranslations = await TranslationProcessor.GetTranslations(textElement); foreach (var translation in allTranslations) if (this.translationComponents.ContainsKey(translation.Culture)) - this.translationComponents[translation.Culture].Configure(translation); + await this.translationComponents[translation.Culture].Configure(translation); }; }